/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { MutableCluster } from "../cluster/mutation/MutableCluster.js";
import { Command, TlvNoResponse, Attribute } from "../cluster/Cluster.js";
import { TlvField, TlvObject } from "../tlv/TlvObject.js";
import { TlvUInt8, TlvEnum } from "../tlv/TlvNumber.js";
import { TlvString } from "../tlv/TlvString.js";
import { AccessLevel } from "#model";
import { BitFlag } from "../schema/BitmapSchema.js";
import { TlvArray } from "../tlv/TlvArray.js";
import { TlvNoArguments } from "../tlv/TlvNoArguments.js";
import { ClusterRegistry } from "../cluster/ClusterRegistry.js";
var MediaInput;
((MediaInput2) => {
  let Feature;
  ((Feature2) => {
    Feature2["NameUpdates"] = "NameUpdates";
  })(Feature = MediaInput2.Feature || (MediaInput2.Feature = {}));
  MediaInput2.TlvRenameInputRequest = TlvObject({ index: TlvField(0, TlvUInt8), name: TlvField(1, TlvString) });
  let InputType;
  ((InputType2) => {
    InputType2[InputType2["Internal"] = 0] = "Internal";
    InputType2[InputType2["Aux"] = 1] = "Aux";
    InputType2[InputType2["Coax"] = 2] = "Coax";
    InputType2[InputType2["Composite"] = 3] = "Composite";
    InputType2[InputType2["Hdmi"] = 4] = "Hdmi";
    InputType2[InputType2["Input"] = 5] = "Input";
    InputType2[InputType2["Line"] = 6] = "Line";
    InputType2[InputType2["Optical"] = 7] = "Optical";
    InputType2[InputType2["Video"] = 8] = "Video";
    InputType2[InputType2["Scart"] = 9] = "Scart";
    InputType2[InputType2["Usb"] = 10] = "Usb";
    InputType2[InputType2["Other"] = 11] = "Other";
  })(InputType = MediaInput2.InputType || (MediaInput2.InputType = {}));
  MediaInput2.TlvInputInfo = TlvObject({
    /**
     * This field shall indicate the unique index into the list of Inputs.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.9.5.2.1
     */
    index: TlvField(0, TlvUInt8),
    /**
     * This field shall indicate the type of input
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.9.5.2.2
     */
    inputType: TlvField(1, TlvEnum()),
    /**
     * This field shall indicate the input name, such as “HDMI 1”. This field may be blank, but SHOULD be provided
     * when known.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.9.5.2.3
     */
    name: TlvField(2, TlvString),
    /**
     * This field shall indicate the user editable input description, such as “Living room Playstation”. This field
     * may be blank, but SHOULD be provided when known.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.9.5.2.4
     */
    description: TlvField(3, TlvString)
  });
  MediaInput2.TlvSelectInputRequest = TlvObject({
    /**
     * This field shall indicate the index field of the InputInfoStruct from the InputList attribute in which to
     * change to.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.9.7.1.1
     */
    index: TlvField(0, TlvUInt8)
  });
  MediaInput2.NameUpdatesComponent = MutableCluster.Component({
    commands: {
      /**
       * Upon receipt, this command shall rename the input at a specific index in the Input List.
       *
       * Updates to the input name shall appear in the device’s settings menus.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 6.9.7.4
       */
      renameInput: Command(3, MediaInput2.TlvRenameInputRequest, 3, TlvNoResponse, { invokeAcl: AccessLevel.Manage })
    }
  });
  MediaInput2.Base = MutableCluster.Component({
    id: 1287,
    name: "MediaInput",
    revision: 1,
    features: {
      /**
       * Supports updates to the input names
       */
      nameUpdates: BitFlag(0)
    },
    attributes: {
      /**
       * This attribute shall provide a list of the media inputs supported by the device.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 6.9.6.1
       */
      inputList: Attribute(0, TlvArray(MediaInput2.TlvInputInfo), { default: [] }),
      /**
       * This attribute shall contain the value of the index field of the currently selected InputInfoStruct.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 6.9.6.2
       */
      currentInput: Attribute(1, TlvUInt8)
    },
    commands: {
      /**
       * Upon receipt, this command shall change the media input on the device to the input at a specific index in
       * the Input List.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 6.9.7.1
       */
      selectInput: Command(0, MediaInput2.TlvSelectInputRequest, 0, TlvNoResponse),
      /**
       * Upon receipt, this command shall display the active status of the input list on screen.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 6.9.7.2
       */
      showInputStatus: Command(1, TlvNoArguments, 1, TlvNoResponse),
      /**
       * Upon receipt, this command shall hide the input list from the screen.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 6.9.7.3
       */
      hideInputStatus: Command(2, TlvNoArguments, 2, TlvNoResponse)
    },
    /**
     * This metadata controls which MediaInputCluster elements matter.js activates for specific feature
     * combinations.
     */
    extensions: MutableCluster.Extensions({ flags: { nameUpdates: true }, component: MediaInput2.NameUpdatesComponent })
  });
  MediaInput2.ClusterInstance = MutableCluster(MediaInput2.Base);
  MediaInput2.Cluster = MediaInput2.ClusterInstance;
  const NU = { nameUpdates: true };
  MediaInput2.CompleteInstance = MutableCluster({
    id: MediaInput2.Cluster.id,
    name: MediaInput2.Cluster.name,
    revision: MediaInput2.Cluster.revision,
    features: MediaInput2.Cluster.features,
    attributes: MediaInput2.Cluster.attributes,
    commands: {
      ...MediaInput2.Cluster.commands,
      renameInput: MutableCluster.AsConditional(MediaInput2.NameUpdatesComponent.commands.renameInput, { mandatoryIf: [NU] })
    }
  });
  MediaInput2.Complete = MediaInput2.CompleteInstance;
})(MediaInput || (MediaInput = {}));
const MediaInputCluster = MediaInput.Cluster;
ClusterRegistry.register(MediaInput.Complete);
export {
  MediaInput,
  MediaInputCluster
};
//# sourceMappingURL=media-input.js.map
