// 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.

package org.wpilib.hardware.pneumatic;

import org.wpilib.hardware.hal.REVPHJNI;

/** Compressor config type. */
public enum CompressorConfigType {
  /** Disabled. */
  DISABLED(REVPHJNI.COMPRESSOR_CONFIG_TYPE_DISABLED),
  /** Digital. */
  DIGITAL(REVPHJNI.COMPRESSOR_CONFIG_TYPE_DIGITAL),
  /** Analog. */
  ANALOG(REVPHJNI.COMPRESSOR_CONFIG_TYPE_ANALOG),
  /** Hybrid. */
  HYBRID(REVPHJNI.COMPRESSOR_CONFIG_TYPE_HYBRID);

  /** CompressorConfigType value. */
  public final int value;

  CompressorConfigType(int value) {
    this.value = value;
  }

  /**
   * Gets a type from an int value.
   *
   * @param value int value
   * @return type
   */
  public static CompressorConfigType fromValue(int value) {
    return switch (value) {
      case REVPHJNI.COMPRESSOR_CONFIG_TYPE_HYBRID -> HYBRID;
      case REVPHJNI.COMPRESSOR_CONFIG_TYPE_ANALOG -> ANALOG;
      case REVPHJNI.COMPRESSOR_CONFIG_TYPE_DIGITAL -> DIGITAL;
      default -> DISABLED;
    };
  }

  /**
   * Returns the CompressorConfigType's value.
   *
   * @return The CompressorConfigType's value.
   */
  public int getValue() {
    return value;
  }
}
