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

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

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

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

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

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

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

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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

  @Override
  public Current per(ResistanceUnit divisorUnit) {
    return div(divisorUnit.one());
  }


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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

}
