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

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

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

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

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

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

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

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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


  @Override
  public Voltage times(Resistance multiplier) {
    return Volts.of(baseUnitMagnitude() * multiplier.baseUnitMagnitude());
  }

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

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


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

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

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


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

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

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


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

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

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


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

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

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


  @Override
  public Power times(Voltage multiplier) {
    return Watts.of(baseUnitMagnitude() * multiplier.baseUnitMagnitude());
  }

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

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

}
