// 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 Distance(double magnitude, double baseUnitMagnitude, DistanceUnit unit) implements Measure<DistanceUnit> {
  /**
   * For doing math with measures of a known dimension but an unknown unit. Most users should use
   * {@link DistanceUnit#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  Distance ofRelativeUnits(double magnitude, DistanceUnit unit) {
    return new Distance(magnitude, unit.toBaseUnits(magnitude), unit);
  }

  /**
   * For doing math with measures of a known dimension but an unknown unit. Most users should use
   * {@link DistanceUnit#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  Distance ofBaseUnits(double baseUnitMagnitude, DistanceUnit unit) {
    return new Distance(unit.fromBaseUnits(baseUnitMagnitude), baseUnitMagnitude, unit);
  }

  @Override
  public DistanceUnit baseUnit() { return (DistanceUnit) unit().getBaseUnit(); }

  @Override
  public double in(DistanceUnit unit) {
    return unit.fromBaseUnits(baseUnitMagnitude());
  }

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

  @Override
  public Distance unaryMinus() {
    return (Distance) unit().ofBaseUnits(0 - baseUnitMagnitude());
  }

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

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

  @Override
  public Distance times(double multiplier) {
    return (Distance) unit().ofBaseUnits(baseUnitMagnitude() * multiplier);
  }

  @Override
  public Distance div(double divisor) {
    return (Distance) unit().ofBaseUnits(baseUnitMagnitude() / divisor);
  }


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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

  @Override
  public Distance div(Dimensionless divisor) {
    return (Distance) Meters.of(baseUnitMagnitude() / divisor.baseUnitMagnitude());
  }

  @Override
  public Distance times(Dimensionless multiplier) {
    return (Distance) Meters.of(baseUnitMagnitude() * multiplier.baseUnitMagnitude());
  }


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

  @Override
  public Dimensionless div(Distance divisor) {
    return Value.of(baseUnitMagnitude() / divisor.baseUnitMagnitude());
  }

  @Override
  public Dimensionless per(DistanceUnit divisorUnit) {
    return div(divisorUnit.one());
  }


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

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

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


  @Override
  public Torque times(Force multiplier) {
    return NewtonMeters.of(baseUnitMagnitude() * multiplier.baseUnitMagnitude());
  }

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

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


  @Override
  public LinearVelocity times(Frequency multiplier) {
    return MetersPerSecond.of(baseUnitMagnitude() * multiplier.baseUnitMagnitude());
  }

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

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


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

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

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


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

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

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


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

  @Override
  public Time div(LinearVelocity divisor) {
    return Seconds.of(baseUnitMagnitude() / divisor.baseUnitMagnitude());
  }

  @Override
  public Time per(LinearVelocityUnit divisorUnit) {
    return div(divisorUnit.one());
  }


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


  @Override
  public Mult<DistanceUnit, TimeUnit> times(Time multiplier) {
    return (Mult<DistanceUnit, TimeUnit>) Measure.super.times(multiplier);
  }

  @Override
  public LinearVelocity div(Time divisor) {
    return MetersPerSecond.of(baseUnitMagnitude() / divisor.baseUnitMagnitude());
  }

  @Override
  public LinearVelocity per(TimeUnit divisorUnit) {
    return div(divisorUnit.one());
  }


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

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

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


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

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

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


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

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

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

}
