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

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

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

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

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

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

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

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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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

}
