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

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

  @Override
  public MultUnit<A, B> baseUnit() { return (MultUnit<A, B>) unit().getBaseUnit(); }

  @Override
  public double in(MultUnit<A, B> unit) {
    return unit.fromBaseUnits(baseUnitMagnitude());
  }

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

  @Override
  public Mult<A, B> unaryMinus() {
    return (Mult<A, B>) unit().ofBaseUnits(0 - baseUnitMagnitude());
  }

  @Override
  public Mult<A, B> plus(Measure<? extends MultUnit<A, B>> other) {
    return (Mult<A, B>) unit().ofBaseUnits(baseUnitMagnitude() + other.baseUnitMagnitude());
  }

  @Override
  public Mult<A, B> minus(Measure<? extends MultUnit<A, B>> other) {
    return (Mult<A, B>) unit().ofBaseUnits(baseUnitMagnitude() - other.baseUnitMagnitude());
  }

  @Override
  public Mult<A, B> times(double multiplier) {
    return (Mult<A, B>) unit().ofBaseUnits(baseUnitMagnitude() * multiplier);
  }

  @Override
  public Mult<A, B> div(double divisor) {
    return (Mult<A, B>) unit().ofBaseUnits(baseUnitMagnitude() / divisor);
  }


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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

  @Override
  public Mult<A, B> div(Dimensionless divisor) {
    return (Mult<A, B>) unit().of(baseUnitMagnitude() / divisor.baseUnitMagnitude());
  }

  @Override
  public Mult<A, B> times(Dimensionless multiplier) {
    return (Mult<A, B>) unit().of(baseUnitMagnitude() * multiplier.baseUnitMagnitude());
  }


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

  @Override
  public Velocity<MultUnit<A, B>> per(TimeUnit divisorUnit) {
    return div(divisorUnit.one());
  }


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

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

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


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

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

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


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

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

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

}
