/**
 * @license
 * Copyright 2022-2024 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { MatterDefinition } from "../MatterDefinition.js";
import {
  ClusterElement as Cluster,
  AttributeElement as Attribute,
  FieldElement as Field,
  CommandElement as Command,
  DatatypeElement as Datatype
} from "../../elements/index.js";
const KeypadInput = Cluster({
  name: "KeypadInput",
  id: 1289,
  classification: "application",
  pics: "KEYPADINPUT",
  details: "This cluster provides an interface for key code based input and control on a device like a Video Player or an endpoint like a Content App. This may include text or action commands such as UP, DOWN, and SELECT.\nThis cluster would be supported on Video Player devices as well as devices that support remote control input from a keypad or remote. This cluster provides the list of supported keypad inputs and provides a command for sending them.\nThe cluster server for Keypad Input is implemented by a device that can receive keypad input, such as a Video Player, or an endpoint that can receive keypad input, such as a Content App.\nThe key codes used are those defined in the HDMI CEC specification (see HDMI).\nDevices may understand a subset of these key codes. Feature flags are used to indicate a specific subset that is supported. Device may support additional codes beyond what is indicated in feature flags.",
  xref: { document: "cluster", section: "6.8" },
  children: [
    Attribute({ name: "ClusterRevision", id: 65533, type: "ClusterRevision", default: 1 }),
    Attribute({
      name: "FeatureMap",
      id: 65532,
      type: "FeatureMap",
      xref: { document: "cluster", section: "6.8.4" },
      children: [
        Field({
          name: "NV",
          constraint: "0",
          description: "NavigationKeyCodes",
          details: "Supports UP, DOWN, LEFT, RIGHT, SELECT, BACK, EXIT, MENU"
        }),
        Field({
          name: "LK",
          constraint: "1",
          description: "LocationKeys",
          details: "Supports CEC keys 0x0A (Settings) and 0x09 (Home)"
        }),
        Field({
          name: "NK",
          constraint: "2",
          description: "NumberKeys",
          details: "Supports numeric input 0..9"
        })
      ]
    }),
    Command({
      name: "SendKey",
      id: 0,
      access: "O",
      conformance: "M",
      direction: "request",
      response: "SendKeyResponse",
      details: "Upon receipt, this shall process a keycode as input to the media endpoint.\nIf a device has multiple media endpoints implementing this cluster, such as a casting video player endpoint with one or more content app endpoints, then only the endpoint receiving the command shall process the keycode as input. In other words, a specific content app endpoint shall NOT process a keycode received by a different content app endpoint.\nIf a second SendKey request with the same KeyCode value is received within 200 ms, then the endpoint will consider the first key press to be a press and hold. When such a repeat KeyCode value is not received within 200 ms, then the endpoint will consider the last key press to be a release.",
      xref: { document: "cluster", section: "6.8.6.1" },
      children: [Field({
        name: "KeyCode",
        id: 0,
        type: "CecKeyCodeEnum",
        conformance: "M",
        details: "This field shall indicate the key code to process.",
        xref: { document: "cluster", section: "6.8.6.1.1" }
      })]
    }),
    Command({
      name: "SendKeyResponse",
      id: 1,
      conformance: "M",
      direction: "response",
      details: "This command shall be generated in response to a SendKey command.",
      xref: { document: "cluster", section: "6.8.6.2" },
      children: [Field({
        name: "Status",
        id: 0,
        type: "StatusEnum",
        conformance: "M",
        details: "This field shall indicate the status of the request.",
        xref: { document: "cluster", section: "6.8.6.2.1" }
      })]
    }),
    Datatype({
      name: "StatusEnum",
      type: "enum8",
      xref: { document: "cluster", section: "6.8.5.1" },
      children: [
        Field({ name: "Success", id: 0, conformance: "M", description: "Succeeded" }),
        Field({ name: "UnsupportedKey", id: 1, conformance: "M", description: "Key code is not supported." }),
        Field({
          name: "InvalidKeyInCurrentState",
          id: 2,
          conformance: "M",
          description: "Requested key code is invalid in the context of the responder\u2019s current state."
        })
      ]
    }),
    Datatype({
      name: "CecKeyCodeEnum",
      type: "enum8",
      xref: { document: "cluster", section: "6.8.5.2" },
      children: [
        Field({ name: "Select", id: 0, conformance: "M" }),
        Field({ name: "Up", id: 1, conformance: "M" }),
        Field({ name: "Down", id: 2, conformance: "M" }),
        Field({ name: "Left", id: 3, conformance: "M" }),
        Field({ name: "Right", id: 4, conformance: "M" }),
        Field({ name: "RightUp", id: 5, conformance: "M" }),
        Field({ name: "RightDown", id: 6, conformance: "M" }),
        Field({ name: "LeftUp", id: 7, conformance: "M" }),
        Field({ name: "LeftDown", id: 8, conformance: "M" }),
        Field({ name: "RootMenu", id: 9, conformance: "M" }),
        Field({ name: "SetupMenu", id: 10, conformance: "M" }),
        Field({ name: "ContentsMenu", id: 11, conformance: "M" }),
        Field({ name: "FavoriteMenu", id: 12, conformance: "M" }),
        Field({ name: "Exit", id: 13, conformance: "M" }),
        Field({ name: "MediaTopMenu", id: 16, conformance: "M" }),
        Field({ name: "MediaContextSensitiveMenu", id: 17, conformance: "M" }),
        Field({ name: "NumberEntryMode", id: 29, conformance: "M" }),
        Field({ name: "Number11", id: 30, conformance: "M" }),
        Field({ name: "Number12", id: 31, conformance: "M" }),
        Field({ name: "Number0OrNumber10", id: 32, conformance: "M" }),
        Field({ name: "Numbers1", id: 33, conformance: "M" }),
        Field({ name: "Numbers2", id: 34, conformance: "M" }),
        Field({ name: "Numbers3", id: 35, conformance: "M" }),
        Field({ name: "Numbers4", id: 36, conformance: "M" }),
        Field({ name: "Numbers5", id: 37, conformance: "M" }),
        Field({ name: "Numbers6", id: 38, conformance: "M" }),
        Field({ name: "Numbers7", id: 39, conformance: "M" }),
        Field({ name: "Numbers8", id: 40, conformance: "M" }),
        Field({ name: "Numbers9", id: 41, conformance: "M" }),
        Field({ name: "Dot", id: 42, conformance: "M" }),
        Field({ name: "Enter", id: 43, conformance: "M" }),
        Field({ name: "Clear", id: 44, conformance: "M" }),
        Field({ name: "NextFavorite", id: 47, conformance: "M" }),
        Field({ name: "ChannelUp", id: 48, conformance: "M" }),
        Field({ name: "ChannelDown", id: 49, conformance: "M" }),
        Field({ name: "PreviousChannel", id: 50, conformance: "M" }),
        Field({ name: "SoundSelect", id: 51, conformance: "M" }),
        Field({ name: "InputSelect", id: 52, conformance: "M" }),
        Field({ name: "DisplayInformation", id: 53, conformance: "M" }),
        Field({ name: "Help", id: 54, conformance: "M" }),
        Field({ name: "PageUp", id: 55, conformance: "M" }),
        Field({ name: "PageDown", id: 56, conformance: "M" }),
        Field({ name: "Power", id: 64, conformance: "M" }),
        Field({ name: "VolumeUp", id: 65, conformance: "M" }),
        Field({ name: "VolumeDown", id: 66, conformance: "M" }),
        Field({ name: "Mute", id: 67, conformance: "M" }),
        Field({ name: "Play", id: 68, conformance: "M" }),
        Field({ name: "Stop", id: 69, conformance: "M" }),
        Field({ name: "Pause", id: 70, conformance: "M" }),
        Field({ name: "Record", id: 71, conformance: "M" }),
        Field({ name: "Rewind", id: 72, conformance: "M" }),
        Field({ name: "FastForward", id: 73, conformance: "M" }),
        Field({ name: "Eject", id: 74, conformance: "M" }),
        Field({ name: "Forward", id: 75, conformance: "M" }),
        Field({ name: "Backward", id: 76, conformance: "M" }),
        Field({ name: "StopRecord", id: 77, conformance: "M" }),
        Field({ name: "PauseRecord", id: 78, conformance: "M" }),
        Field({ name: "Angle", id: 80, conformance: "M" }),
        Field({ name: "SubPicture", id: 81, conformance: "M" }),
        Field({ name: "VideoOnDemand", id: 82, conformance: "M" }),
        Field({ name: "ElectronicProgramGuide", id: 83, conformance: "M" }),
        Field({ name: "TimerProgramming", id: 84, conformance: "M" }),
        Field({ name: "InitialConfiguration", id: 85, conformance: "M" }),
        Field({ name: "SelectBroadcastType", id: 86, conformance: "M" }),
        Field({ name: "SelectSoundPresentation", id: 87, conformance: "M" }),
        Field({ name: "PlayFunction", id: 96, conformance: "M" }),
        Field({ name: "PausePlayFunction", id: 97, conformance: "M" }),
        Field({ name: "RecordFunction", id: 98, conformance: "M" }),
        Field({ name: "PauseRecordFunction", id: 99, conformance: "M" }),
        Field({ name: "StopFunction", id: 100, conformance: "M" }),
        Field({ name: "MuteFunction", id: 101, conformance: "M" }),
        Field({ name: "RestoreVolumeFunction", id: 102, conformance: "M" }),
        Field({ name: "TuneFunction", id: 103, conformance: "M" }),
        Field({ name: "SelectMediaFunction", id: 104, conformance: "M" }),
        Field({ name: "SelectAvInputFunction", id: 105, conformance: "M" }),
        Field({ name: "SelectAudioInputFunction", id: 106, conformance: "M" }),
        Field({ name: "PowerToggleFunction", id: 107, conformance: "M" }),
        Field({ name: "PowerOffFunction", id: 108, conformance: "M" }),
        Field({ name: "PowerOnFunction", id: 109, conformance: "M" }),
        Field({ name: "F1Blue", id: 113, conformance: "M" }),
        Field({ name: "F2Red", id: 114, conformance: "M" }),
        Field({ name: "F3Green", id: 115, conformance: "M" }),
        Field({ name: "F4Yellow", id: 116, conformance: "M" }),
        Field({ name: "F5", id: 117, conformance: "M" }),
        Field({ name: "Data", id: 118, conformance: "M" })
      ]
    })
  ]
});
MatterDefinition.children.push(KeypadInput);
export {
  KeypadInput
};
//# sourceMappingURL=KeypadInput.js.map
