import { unsafeCSS, LitElement, html } from "lit";
import { property } from "lit/decorators.js";
import compentStyle from "./azimuth-thruster-labeled.css.js";
import { CommandStatus } from "../badge-command/badge-command.js";
import { classMap } from "lit/directives/class-map.js";
import { InstrumentFieldSize } from "../instrument-field/instrument-field.js";
import "../azimuth-thruster/azimuth-thruster.js";
import { InstrumentState, Priority } from "../types.js";
import { ifDefined } from "lit/directives/if-defined.js";
import { PropellerType } from "../thruster/propeller.js";
import { TickmarkStyle } from "../watch/tickmark.js";
import { customElement } from "../../decorator.js";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
    if (decorator = decorators[i])
      result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  if (kind && result) __defProp(target, key, result);
  return result;
};
var AzimuthThrusterLabeledSize = /* @__PURE__ */ ((AzimuthThrusterLabeledSize2) => {
  AzimuthThrusterLabeledSize2["medium"] = "medium";
  AzimuthThrusterLabeledSize2["large"] = "large";
  return AzimuthThrusterLabeledSize2;
})(AzimuthThrusterLabeledSize || {});
let ObcAzimuthThrusterLabeled = class extends LitElement {
  constructor() {
    super(...arguments);
    this.label = "";
    this.commandStatus = CommandStatus.InCommand;
    this.size = "medium";
    this.angle = 0;
    this.atAngleSetpoint = false;
    this.angleSetpointAtZeroDeadband = 0.5;
    this.angleSetpointOverride = false;
    this.autoAtAngleSetpoint = true;
    this.autoAtAngleSetpointDeadband = 2;
    this.touching = false;
    this.thrust = 0;
    this.atThrustSetpoint = false;
    this.autoAtThrustSetpoint = true;
    this.autoAtThrustSetpointDeadband = 1;
    this.thrustSetpointAtZeroDeadband = 0.1;
    this.thrustSetpointOverride = false;
    this.angleAdvices = [];
    this.thrustAdvices = [];
    this.tickmarkStyle = TickmarkStyle.regular;
    this.singleDirection = false;
    this.topPropeller = PropellerType.none;
    this.bottomPropeller = PropellerType.none;
  }
  render() {
    const fieldSize = this.size === "large" ? InstrumentFieldSize.enhanced : InstrumentFieldSize.regular;
    let state = InstrumentState.active;
    let priority = Priority.enhanced;
    if ([
      CommandStatus.NoCommand,
      CommandStatus.Blocked,
      CommandStatus.CommandAvailable
    ].includes(this.commandStatus)) {
      state = InstrumentState.active;
      priority = Priority.regular;
    }
    return html`
      <div class=${classMap({ wrapper: true, [this.size]: true })}>
        <div class="label">
          <obc-badge-command
            class="badge"
            status=${this.commandStatus}
            ?large=${this.size === "large"}
          ></obc-badge-command>
          <div class="label-text">${this.label}</div>
        </div>
        <obc-instrument-field
          class="instrument-field-angle"
          value=${this.angle}
          setpoint=${ifDefined(this.angleSetpoint)}
          tag="Angle"
          unit="DEG"
          hasSetpoint
          size=${fieldSize}
        ></obc-instrument-field>
        <obc-instrument-field
          class="instrument-field-power"
          value=${this.thrust}
          setpoint=${ifDefined(this.thrustSetpoint)}
          tag="Power"
          unit="%"
          hasSetpoint
          size=${fieldSize}
        ></obc-instrument-field>
        <obc-azimuth-thruster
          class="azimuth-thruster"
          .hasLabelSpacer=${false}
          .thrust=${this.thrust}
          .thrustSetpoint=${this.thrustSetpoint}
          .autoAtThrustSetpoint=${this.autoAtThrustSetpoint}
          .autoAtThrustSetpointDeadband=${this.autoAtThrustSetpointDeadband}
          .angle=${this.angle}
          .angleSetpoint=${this.angleSetpoint}
          .autoAtAngleSetpoint=${this.autoAtAngleSetpoint}
          .autoAtAngleSetpointDeadband=${this.autoAtAngleSetpointDeadband}
          .atThrustSetpoint=${this.atThrustSetpoint}
          .atAngleSetpoint=${this.atAngleSetpoint}
          .newAngleSetpoint=${this.newAngleSetpoint}
          .angleSetpointAtZeroDeadband=${this.angleSetpointAtZeroDeadband}
          .angleSetpointOverride=${this.angleSetpointOverride}
          .thrustSetpointAtZeroDeadband=${this.thrustSetpointAtZeroDeadband}
          .thrustSetpointOverride=${this.thrustSetpointOverride}
          .state=${state}
          .priority=${priority}
          .touching=${this.touching}
          .angleAdvices=${this.angleAdvices}
          .thrustAdvices=${this.thrustAdvices}
          .singleDirection=${this.singleDirection}
          .tickmarkStyle=${this.tickmarkStyle}
          .topPropeller=${this.topPropeller}
          .bottomPropeller=${this.bottomPropeller}
        ></obc-azimuth-thruster>
      </div>
    `;
  }
};
ObcAzimuthThrusterLabeled.styles = unsafeCSS(compentStyle);
__decorateClass([
  property({ type: String })
], ObcAzimuthThrusterLabeled.prototype, "label", 2);
__decorateClass([
  property({ type: String })
], ObcAzimuthThrusterLabeled.prototype, "commandStatus", 2);
__decorateClass([
  property({ type: String })
], ObcAzimuthThrusterLabeled.prototype, "size", 2);
__decorateClass([
  property({ type: Number })
], ObcAzimuthThrusterLabeled.prototype, "angle", 2);
__decorateClass([
  property({ type: Number })
], ObcAzimuthThrusterLabeled.prototype, "angleSetpoint", 2);
__decorateClass([
  property({ type: Number })
], ObcAzimuthThrusterLabeled.prototype, "newAngleSetpoint", 2);
__decorateClass([
  property({ type: Boolean })
], ObcAzimuthThrusterLabeled.prototype, "atAngleSetpoint", 2);
__decorateClass([
  property({ type: Number })
], ObcAzimuthThrusterLabeled.prototype, "angleSetpointAtZeroDeadband", 2);
__decorateClass([
  property({ type: Boolean })
], ObcAzimuthThrusterLabeled.prototype, "angleSetpointOverride", 2);
__decorateClass([
  property({ type: Boolean, attribute: false })
], ObcAzimuthThrusterLabeled.prototype, "autoAtAngleSetpoint", 2);
__decorateClass([
  property({ type: Number })
], ObcAzimuthThrusterLabeled.prototype, "autoAtAngleSetpointDeadband", 2);
__decorateClass([
  property({ type: Boolean })
], ObcAzimuthThrusterLabeled.prototype, "touching", 2);
__decorateClass([
  property({ type: Number })
], ObcAzimuthThrusterLabeled.prototype, "thrust", 2);
__decorateClass([
  property({ type: Number })
], ObcAzimuthThrusterLabeled.prototype, "thrustSetpoint", 2);
__decorateClass([
  property({ type: Boolean })
], ObcAzimuthThrusterLabeled.prototype, "atThrustSetpoint", 2);
__decorateClass([
  property({ type: Boolean, attribute: false })
], ObcAzimuthThrusterLabeled.prototype, "autoAtThrustSetpoint", 2);
__decorateClass([
  property({ type: Number })
], ObcAzimuthThrusterLabeled.prototype, "autoAtThrustSetpointDeadband", 2);
__decorateClass([
  property({ type: Number })
], ObcAzimuthThrusterLabeled.prototype, "thrustSetpointAtZeroDeadband", 2);
__decorateClass([
  property({ type: Boolean })
], ObcAzimuthThrusterLabeled.prototype, "thrustSetpointOverride", 2);
__decorateClass([
  property({ type: Array, attribute: false })
], ObcAzimuthThrusterLabeled.prototype, "angleAdvices", 2);
__decorateClass([
  property({ type: Array, attribute: false })
], ObcAzimuthThrusterLabeled.prototype, "thrustAdvices", 2);
__decorateClass([
  property({ type: String })
], ObcAzimuthThrusterLabeled.prototype, "tickmarkStyle", 2);
__decorateClass([
  property({ type: Boolean })
], ObcAzimuthThrusterLabeled.prototype, "singleDirection", 2);
__decorateClass([
  property({ type: String })
], ObcAzimuthThrusterLabeled.prototype, "topPropeller", 2);
__decorateClass([
  property({ type: String })
], ObcAzimuthThrusterLabeled.prototype, "bottomPropeller", 2);
ObcAzimuthThrusterLabeled = __decorateClass([
  customElement("obc-azimuth-thruster-labeled")
], ObcAzimuthThrusterLabeled);
export {
  AzimuthThrusterLabeledSize,
  ObcAzimuthThrusterLabeled
};
//# sourceMappingURL=azimuth-thruster-labeled.js.map
