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

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

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

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

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

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

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

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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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

}
