// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

// THIS FILE WAS AUTO-GENERATED BY ./wpiunits/generate_units.py. DO NOT MODIFY

package org.wpilib.units.measure;

import static org.wpilib.units.Units.*;
import org.wpilib.units.*;

@SuppressWarnings({"unchecked", "cast", "checkstyle"})
public record Velocity<D extends Unit>(double magnitude, double baseUnitMagnitude, VelocityUnit<D> unit) implements Measure<VelocityUnit<D>> {
  /**
   * For doing math with measures of a known dimension but an unknown unit. Most users should use
   * {@link VelocityUnit#of(double)} on a known unit from {@link Units} instead of calling this method.
   * @param magnitude the magnitude of the measurement in terms of the given unit
   * @param unit the unit of the measurement
   * @return a measurement object
   */
  public static <D extends Unit> Velocity<D> ofRelativeUnits(double magnitude, VelocityUnit<D> unit) {
    return new Velocity<D>(magnitude, unit.toBaseUnits(magnitude), unit);
  }

  /**
   * For doing math with measures of a known dimension but an unknown unit. Most users should use
   * {@link VelocityUnit#of(double)} on a known unit from {@link Units} instead of calling this method.
   * @param baseUnitMagnitude the magnitude of the measurement in terms of the given unit's base unit
   * @param unit the unit of the measurement
   * @return a measurement object
   */
  public static <D extends Unit> Velocity<D> ofBaseUnits(double baseUnitMagnitude, VelocityUnit<D> unit) {
    return new Velocity<D>(unit.fromBaseUnits(baseUnitMagnitude), baseUnitMagnitude, unit);
  }

  @Override
  public VelocityUnit<D> baseUnit() { return (VelocityUnit<D>) unit().getBaseUnit(); }

  @Override
  public double in(VelocityUnit<D> unit) {
    return unit.fromBaseUnits(baseUnitMagnitude());
  }

  @Override
  @SuppressWarnings("rawtypes")
  public boolean equals(Object object) {
    return object instanceof Velocity m && isEquivalent(m);
  }

  @Override
  public Velocity<D> unaryMinus() {
    return (Velocity<D>) unit().ofBaseUnits(0 - baseUnitMagnitude());
  }

  @Override
  public Velocity<D> plus(Measure<? extends VelocityUnit<D>> other) {
    return (Velocity<D>) unit().ofBaseUnits(baseUnitMagnitude() + other.baseUnitMagnitude());
  }

  @Override
  public Velocity<D> minus(Measure<? extends VelocityUnit<D>> other) {
    return (Velocity<D>) unit().ofBaseUnits(baseUnitMagnitude() - other.baseUnitMagnitude());
  }

  @Override
  public Velocity<D> times(double multiplier) {
    return (Velocity<D>) unit().ofBaseUnits(baseUnitMagnitude() * multiplier);
  }

  @Override
  public Velocity<D> div(double divisor) {
    return (Velocity<D>) unit().ofBaseUnits(baseUnitMagnitude() / divisor);
  }


  @Override
  public Mult<VelocityUnit<D>, AccelerationUnit<?>> times(Acceleration<?> multiplier) {
    return (Mult<VelocityUnit<D>, AccelerationUnit<?>>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, AccelerationUnit<?>> div(Acceleration<?> divisor) {
    return (Per<VelocityUnit<D>, AccelerationUnit<?>>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, AccelerationUnit<?>> per(AccelerationUnit<?> divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, AngleUnit> times(Angle multiplier) {
    return (Mult<VelocityUnit<D>, AngleUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, AngleUnit> div(Angle divisor) {
    return (Per<VelocityUnit<D>, AngleUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, AngleUnit> per(AngleUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, AngularAccelerationUnit> times(AngularAcceleration multiplier) {
    return (Mult<VelocityUnit<D>, AngularAccelerationUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, AngularAccelerationUnit> div(AngularAcceleration divisor) {
    return (Per<VelocityUnit<D>, AngularAccelerationUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, AngularAccelerationUnit> per(AngularAccelerationUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, AngularMomentumUnit> times(AngularMomentum multiplier) {
    return (Mult<VelocityUnit<D>, AngularMomentumUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, AngularMomentumUnit> div(AngularMomentum divisor) {
    return (Per<VelocityUnit<D>, AngularMomentumUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, AngularMomentumUnit> per(AngularMomentumUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, AngularVelocityUnit> times(AngularVelocity multiplier) {
    return (Mult<VelocityUnit<D>, AngularVelocityUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, AngularVelocityUnit> div(AngularVelocity divisor) {
    return (Per<VelocityUnit<D>, AngularVelocityUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, AngularVelocityUnit> per(AngularVelocityUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, CurrentUnit> times(Current multiplier) {
    return (Mult<VelocityUnit<D>, CurrentUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, CurrentUnit> div(Current divisor) {
    return (Per<VelocityUnit<D>, CurrentUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, CurrentUnit> per(CurrentUnit divisorUnit) {
    return div(divisorUnit.one());
  }

  @Override
  public Velocity<D> div(Dimensionless divisor) {
    return (Velocity<D>) unit().of(baseUnitMagnitude() / divisor.baseUnitMagnitude());
  }

  @Override
  public Velocity<D> times(Dimensionless multiplier) {
    return (Velocity<D>) unit().of(baseUnitMagnitude() * multiplier.baseUnitMagnitude());
  }


  @Override
  public Mult<VelocityUnit<D>, DistanceUnit> times(Distance multiplier) {
    return (Mult<VelocityUnit<D>, DistanceUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, DistanceUnit> div(Distance divisor) {
    return (Per<VelocityUnit<D>, DistanceUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, DistanceUnit> per(DistanceUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, EnergyUnit> times(Energy multiplier) {
    return (Mult<VelocityUnit<D>, EnergyUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, EnergyUnit> div(Energy divisor) {
    return (Per<VelocityUnit<D>, EnergyUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, EnergyUnit> per(EnergyUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, ForceUnit> times(Force multiplier) {
    return (Mult<VelocityUnit<D>, ForceUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, ForceUnit> div(Force divisor) {
    return (Per<VelocityUnit<D>, ForceUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, ForceUnit> per(ForceUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, FrequencyUnit> times(Frequency multiplier) {
    return (Mult<VelocityUnit<D>, FrequencyUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, FrequencyUnit> div(Frequency divisor) {
    return (Per<VelocityUnit<D>, FrequencyUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, FrequencyUnit> per(FrequencyUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, LinearAccelerationUnit> times(LinearAcceleration multiplier) {
    return (Mult<VelocityUnit<D>, LinearAccelerationUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, LinearAccelerationUnit> div(LinearAcceleration divisor) {
    return (Per<VelocityUnit<D>, LinearAccelerationUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, LinearAccelerationUnit> per(LinearAccelerationUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, LinearMomentumUnit> times(LinearMomentum multiplier) {
    return (Mult<VelocityUnit<D>, LinearMomentumUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, LinearMomentumUnit> div(LinearMomentum divisor) {
    return (Per<VelocityUnit<D>, LinearMomentumUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, LinearMomentumUnit> per(LinearMomentumUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, LinearVelocityUnit> times(LinearVelocity multiplier) {
    return (Mult<VelocityUnit<D>, LinearVelocityUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, LinearVelocityUnit> div(LinearVelocity divisor) {
    return (Per<VelocityUnit<D>, LinearVelocityUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, LinearVelocityUnit> per(LinearVelocityUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, MassUnit> times(Mass multiplier) {
    return (Mult<VelocityUnit<D>, MassUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, MassUnit> div(Mass divisor) {
    return (Per<VelocityUnit<D>, MassUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, MassUnit> per(MassUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, MomentOfInertiaUnit> times(MomentOfInertia multiplier) {
    return (Mult<VelocityUnit<D>, MomentOfInertiaUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, MomentOfInertiaUnit> div(MomentOfInertia divisor) {
    return (Per<VelocityUnit<D>, MomentOfInertiaUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, MomentOfInertiaUnit> per(MomentOfInertiaUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, MultUnit<?, ?>> times(Mult<?, ?> multiplier) {
    return (Mult<VelocityUnit<D>, MultUnit<?, ?>>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, MultUnit<?, ?>> div(Mult<?, ?> divisor) {
    return (Per<VelocityUnit<D>, MultUnit<?, ?>>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, MultUnit<?, ?>> per(MultUnit<?, ?> divisorUnit) {
    return div(divisorUnit.ofNative(1));
  }


  @Override
  public Mult<VelocityUnit<D>, PerUnit<?, ?>> times(Per<?, ?> multiplier) {
    return (Mult<VelocityUnit<D>, PerUnit<?, ?>>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, PerUnit<?, ?>> div(Per<?, ?> divisor) {
    return (Per<VelocityUnit<D>, PerUnit<?, ?>>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, PerUnit<?, ?>> per(PerUnit<?, ?> divisorUnit) {
    return div(divisorUnit.ofNative(1));
  }


  @Override
  public Mult<VelocityUnit<D>, PowerUnit> times(Power multiplier) {
    return (Mult<VelocityUnit<D>, PowerUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, PowerUnit> div(Power divisor) {
    return (Per<VelocityUnit<D>, PowerUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, PowerUnit> per(PowerUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, ResistanceUnit> times(Resistance multiplier) {
    return (Mult<VelocityUnit<D>, ResistanceUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, ResistanceUnit> div(Resistance divisor) {
    return (Per<VelocityUnit<D>, ResistanceUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, ResistanceUnit> per(ResistanceUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, TemperatureUnit> times(Temperature multiplier) {
    return (Mult<VelocityUnit<D>, TemperatureUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, TemperatureUnit> div(Temperature divisor) {
    return (Per<VelocityUnit<D>, TemperatureUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, TemperatureUnit> per(TemperatureUnit divisorUnit) {
    return div(divisorUnit.one());
  }

  @Override
  public Measure<D> times(Time multiplier) {
    return (Measure<D>) unit().numerator().ofBaseUnits(baseUnitMagnitude() * multiplier.baseUnitMagnitude());
  }

  @Override
  public Velocity<VelocityUnit<D>> div(Time divisor) {
    return VelocityUnit.combine(unit(), divisor.unit()).ofBaseUnits(baseUnitMagnitude() / divisor.baseUnitMagnitude());
  }

  @Override
  public Velocity<VelocityUnit<D>> per(TimeUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, TorqueUnit> times(Torque multiplier) {
    return (Mult<VelocityUnit<D>, TorqueUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, TorqueUnit> div(Torque divisor) {
    return (Per<VelocityUnit<D>, TorqueUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, TorqueUnit> per(TorqueUnit divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, VelocityUnit<?>> times(Velocity<?> multiplier) {
    return (Mult<VelocityUnit<D>, VelocityUnit<?>>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, VelocityUnit<?>> div(Velocity<?> divisor) {
    return (Per<VelocityUnit<D>, VelocityUnit<?>>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, VelocityUnit<?>> per(VelocityUnit<?> divisorUnit) {
    return div(divisorUnit.one());
  }


  @Override
  public Mult<VelocityUnit<D>, VoltageUnit> times(Voltage multiplier) {
    return (Mult<VelocityUnit<D>, VoltageUnit>) Measure.super.times(multiplier);
  }

  @Override
  public Per<VelocityUnit<D>, VoltageUnit> div(Voltage divisor) {
    return (Per<VelocityUnit<D>, VoltageUnit>) Measure.super.div(divisor);
  }

  @Override
  public Per<VelocityUnit<D>, VoltageUnit> per(VoltageUnit divisorUnit) {
    return div(divisorUnit.one());
  }

}
