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

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

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

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

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

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

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

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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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

}
