"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var ApplicationLauncher_exports = {};
__export(ApplicationLauncher_exports, {
  ApplicationLauncher: () => ApplicationLauncher
});
module.exports = __toCommonJS(ApplicationLauncher_exports);
var import_MatterDefinition = require("../MatterDefinition.js");
var import_elements = require("../../elements/index.js");
/**
 * @license
 * Copyright 2022-2024 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
const ApplicationLauncher = (0, import_elements.ClusterElement)({
  name: "ApplicationLauncher",
  id: 1292,
  classification: "application",
  pics: "APPLAUNCHER",
  details: "This cluster provides an interface for launching applications on a Video Player device such as a TV.\nThis cluster is supported on endpoints that can launch Applications, such as a Casting Video Player device with a Content App Platform. It supports identifying an Application by global identifier from a given catalog, and launching it. It also supports tracking the currently in-focus Application.\nDepending on the support for the Application Platform feature, the cluster can either support launching the application corresponding to the endpoint on which the cluster is supported (AP feature not supported) or it can support launching any application (AP feature supported).",
  xref: { document: "cluster", section: "6.4" },
  children: [
    (0, import_elements.AttributeElement)({ name: "ClusterRevision", id: 65533, type: "ClusterRevision", default: 1 }),
    (0, import_elements.AttributeElement)({
      name: "FeatureMap",
      id: 65532,
      type: "FeatureMap",
      xref: { document: "cluster", section: "6.4.4" },
      children: [(0, import_elements.FieldElement)({
        name: "AP",
        constraint: "0",
        description: "ApplicationPlatform",
        details: "Support for attributes and commands required for endpoint to support launching any application within the supported application catalogs"
      })]
    }),
    (0, import_elements.AttributeElement)({
      name: "CatalogList",
      id: 0,
      type: "list",
      access: "R V",
      conformance: "AP",
      quality: "N",
      details: "This attribute shall specify the list of supported application catalogs, where each entry in the list is the CSA-issued vendor ID for the catalog. The DIAL registry (see [DIAL Registry]) shall use value 0x0000.\nIt is expected that Content App Platform providers will have their own catalog vendor ID (set to their own Vendor ID) and will assign an ApplicationID to each Content App.",
      xref: { document: "cluster", section: "6.4.6.1" },
      children: [(0, import_elements.FieldElement)({ name: "entry", type: "uint16" })]
    }),
    (0, import_elements.AttributeElement)({
      name: "CurrentApp",
      id: 1,
      type: "ApplicationEPStruct",
      access: "R V",
      conformance: "O",
      constraint: "desc",
      default: null,
      quality: "X",
      details: "This attribute shall specify the current in-focus application, identified using an Application ID, catalog vendor ID and the corresponding endpoint number when the application is represented by a Content App endpoint. A null shall be used to indicate there is no current in-focus application.",
      xref: { document: "cluster", section: "6.4.6.2" }
    }),
    (0, import_elements.CommandElement)({
      name: "LaunchApp",
      id: 0,
      access: "O",
      conformance: "M",
      direction: "request",
      response: "LauncherResponse",
      details: "Upon receipt of this command, the server shall launch the application with optional data. The application shall be either\n  \u2022 the specified application, if the Application Platform feature is supported;\n  \u2022 otherwise the application corresponding to the endpoint.\nThe endpoint shall launch and bring to foreground the requisite application if the application is not already launched and in foreground. The Status attribute shall be updated to ActiveVisibleFocus on the Application Basic cluster of the Endpoint corresponding to the launched application. The Status attribute shall be updated on any other application whose Status may have changed as a result of this command. The CurrentApp attribute, if supported, shall be updated to reflect the new application in the foreground.\nThis command returns a Launcher Response.",
      xref: { document: "cluster", section: "6.4.7.1" },
      children: [
        (0, import_elements.FieldElement)({
          name: "Application",
          id: 0,
          type: "ApplicationStruct",
          conformance: "AP",
          constraint: "desc",
          details: "This field shall specify the Application to launch.",
          xref: { document: "cluster", section: "6.4.7.1.1" }
        }),
        (0, import_elements.FieldElement)({
          name: "Data",
          id: 1,
          type: "octstr",
          conformance: "O",
          details: "This field shall specify optional app-specific data to be sent to the app.\nNOTE\nThis format and meaning of this value is proprietary and outside the specification. It provides a transition path for device makers that use other protocols (like DIAL) which allow for proprietary data. Apps that are not yet Matter aware can be launched via Matter, while retaining the existing ability to launch with proprietary data.",
          xref: { document: "cluster", section: "6.4.7.1.2" }
        })
      ]
    }),
    (0, import_elements.CommandElement)({
      name: "StopApp",
      id: 1,
      access: "O",
      conformance: "M",
      direction: "request",
      response: "LauncherResponse",
      details: "Upon receipt of this command, the server shall stop the application if it is running. The application shall be either\n  \u2022 the specified application, if the Application Platform feature is supported;\n  \u2022 otherwise the application corresponding to the endpoint.\nThe Status attribute shall be updated to Stopped on the Application Basic cluster of the Endpoint corresponding to the stopped application. The Status attribute shall be updated on any other application whose Status may have changed as a result of this command.\nThis command returns a Launcher Response.",
      xref: { document: "cluster", section: "6.4.7.2" },
      children: [(0, import_elements.FieldElement)({
        name: "Application",
        id: 0,
        type: "ApplicationStruct",
        conformance: "AP",
        constraint: "desc",
        details: "This field shall specify the Application to stop.",
        xref: { document: "cluster", section: "6.4.7.2.1" }
      })]
    }),
    (0, import_elements.CommandElement)({
      name: "HideApp",
      id: 2,
      access: "O",
      conformance: "M",
      direction: "request",
      response: "LauncherResponse",
      details: "Upon receipt of this command, the server shall hide the application. The application shall be either\n  \u2022 the specified application, if the Application Platform feature is supported;\n  \u2022 otherwise the application corresponding to the endpoint.\nThe endpoint may decide to stop the application based on manufacturer specific behavior or resource constraints if any. The Status attribute shall be updated to ActiveHidden or Stopped, depending on the action taken, on the Application Basic cluster of the Endpoint corresponding to the application on which the action was taken. The Status attribute shall be updated on any other\napplication whose Status may have changed as a result of this command. This command returns a Launcher Response.",
      xref: { document: "cluster", section: "6.4.7.3" },
      children: [(0, import_elements.FieldElement)({
        name: "Application",
        id: 0,
        type: "ApplicationStruct",
        conformance: "AP",
        constraint: "desc",
        details: "This field shall specify the Application to hide.",
        xref: { document: "cluster", section: "6.4.7.3.1" }
      })]
    }),
    (0, import_elements.CommandElement)({
      name: "LauncherResponse",
      id: 3,
      conformance: "M",
      direction: "response",
      details: "This command shall be generated in response to LaunchApp/StopApp/HideApp commands.",
      xref: { document: "cluster", section: "6.4.7.4" },
      children: [
        (0, import_elements.FieldElement)({
          name: "Status",
          id: 0,
          type: "StatusEnum",
          conformance: "M",
          details: "This field shall indicate the status of the command which resulted in this response.",
          xref: { document: "cluster", section: "6.4.7.4.1" }
        }),
        (0, import_elements.FieldElement)({
          name: "Data",
          id: 1,
          type: "octstr",
          conformance: "O",
          details: "This field shall specify Optional app-specific data.",
          xref: { document: "cluster", section: "6.4.7.4.2" }
        })
      ]
    }),
    (0, import_elements.DatatypeElement)({
      name: "StatusEnum",
      type: "enum8",
      xref: { document: "cluster", section: "6.4.5.1" },
      children: [
        (0, import_elements.FieldElement)({ name: "Success", id: 0, conformance: "M", description: "Command succeeded" }),
        (0, import_elements.FieldElement)({
          name: "AppNotAvailable",
          id: 1,
          conformance: "M",
          description: "Requested app is not available."
        }),
        (0, import_elements.FieldElement)({
          name: "SystemBusy",
          id: 2,
          conformance: "M",
          description: "Video platform unable to honor command."
        })
      ]
    }),
    (0, import_elements.DatatypeElement)({
      name: "ApplicationStruct",
      type: "struct",
      details: "This indicates a global identifier for an Application given a catalog.",
      xref: { document: "cluster", section: "6.4.5.2" },
      children: [
        (0, import_elements.FieldElement)({
          name: "CatalogVendorId",
          id: 0,
          type: "uint16",
          conformance: "M",
          details: "This field shall indicate the CSA-issued vendor ID for the catalog. The DIAL registry shall use value 0x0000.\nContent App Platform providers will have their own catalog vendor ID (set to their own Vendor ID) and will assign an ApplicationID to each Content App.",
          xref: { document: "cluster", section: "6.4.5.2.1" }
        }),
        (0, import_elements.FieldElement)({
          name: "ApplicationId",
          id: 1,
          type: "string",
          conformance: "M",
          details: 'This field shall indicate the application identifier, expressed as a string, such as "PruneVideo" or "Company X". This field shall be unique within a catalog.\nFor the DIAL registry catalog, this value shall be the DIAL prefix (see [DIAL Registry]).',
          xref: { document: "cluster", section: "6.4.5.2.2" }
        })
      ]
    }),
    (0, import_elements.DatatypeElement)({
      name: "ApplicationEPStruct",
      type: "struct",
      details: "This specifies an app along with its corresponding endpoint.",
      xref: { document: "cluster", section: "6.4.5.3" },
      children: [
        (0, import_elements.FieldElement)({ name: "Application", id: 0, type: "ApplicationStruct", conformance: "M" }),
        (0, import_elements.FieldElement)({ name: "Endpoint", id: 1, type: "endpoint-no", conformance: "O" })
      ]
    })
  ]
});
import_MatterDefinition.MatterDefinition.children.push(ApplicationLauncher);
//# sourceMappingURL=ApplicationLauncher.js.map
