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

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

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

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

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

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

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

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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


  @Override
  public LinearVelocity times(LinearAcceleration multiplier) {
    return MetersPerSecond.of(baseUnitMagnitude() * multiplier.baseUnitMagnitude());
  }

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

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


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

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

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


  @Override
  public Distance times(LinearVelocity multiplier) {
    return Meters.of(baseUnitMagnitude() * multiplier.baseUnitMagnitude());
  }

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

  @Override
  public Per<TimeUnit, VoltageUnit> per(VoltageUnit divisorUnit) {
    return div(divisorUnit.one());
  }
public Frequency asFrequency() { return Hertz.of(1 / baseUnitMagnitude()); }
}
