/**
 * @license
 * Copyright 2022-2025 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { MatterDefinition } from "../MatterDefinition.js";
import {
  ClusterElement as Cluster,
  AttributeElement as Attribute,
  CommandElement as Command,
  FieldElement as Field,
  DatatypeElement as Datatype
} from "../../elements/index.js";
const OtaSoftwareUpdateProvider = Cluster(
  { name: "OtaSoftwareUpdateProvider", id: 41, classification: "node" },
  Attribute({ name: "ClusterRevision", id: 65533, type: "ClusterRevision", default: 1 }),
  Command(
    {
      name: "QueryImage",
      id: 0,
      access: "O",
      conformance: "M",
      direction: "request",
      response: "QueryImageResponse"
    },
    Field({ name: "VendorId", id: 0, type: "vendor-id", conformance: "M" }),
    Field({ name: "ProductId", id: 1, type: "uint16", conformance: "M" }),
    Field({ name: "SoftwareVersion", id: 2, type: "uint32", conformance: "M" }),
    Field(
      { name: "ProtocolsSupported", id: 3, type: "list", conformance: "M", constraint: "max 8" },
      Field({ name: "entry", type: "DownloadProtocolEnum" })
    ),
    Field({ name: "HardwareVersion", id: 4, type: "uint16", conformance: "O" }),
    Field({ name: "Location", id: 5, type: "string", conformance: "O", constraint: "2" }),
    Field({ name: "RequestorCanConsent", id: 6, type: "bool", conformance: "O", default: false }),
    Field({ name: "MetadataForProvider", id: 7, type: "octstr", conformance: "O", constraint: "max 512" })
  ),
  Command(
    { name: "QueryImageResponse", id: 1, conformance: "M", direction: "response" },
    Field({ name: "Status", id: 0, type: "StatusEnum", conformance: "M" }),
    Field({ name: "DelayedActionTime", id: 1, type: "uint32", conformance: "Status == Busy" }),
    Field({ name: "ImageUri", id: 2, type: "string", conformance: "Status == UpdateAvailable", constraint: "max 256" }),
    Field({ name: "SoftwareVersion", id: 3, type: "uint32", conformance: "Status == UpdateAvailable" }),
    Field({
      name: "SoftwareVersionString",
      id: 4,
      type: "string",
      conformance: "Status == UpdateAvailable",
      constraint: "1 to 64"
    }),
    Field({
      name: "UpdateToken",
      id: 5,
      type: "octstr",
      conformance: "Status == UpdateAvailable",
      constraint: "8 to 32"
    }),
    Field({ name: "UserConsentNeeded", id: 6, type: "bool", conformance: "O", default: false }),
    Field({ name: "MetadataForRequestor", id: 7, type: "octstr", conformance: "O", constraint: "max 512" })
  ),
  Command(
    {
      name: "ApplyUpdateRequest",
      id: 2,
      access: "O",
      conformance: "M",
      direction: "request",
      response: "ApplyUpdateResponse"
    },
    Field({ name: "UpdateToken", id: 0, type: "octstr", conformance: "M", constraint: "8 to 32" }),
    Field({ name: "NewVersion", id: 1, type: "uint32", conformance: "M" })
  ),
  Command(
    { name: "ApplyUpdateResponse", id: 3, conformance: "M", direction: "response" },
    Field({ name: "Action", id: 0, type: "ApplyUpdateActionEnum", conformance: "M" }),
    Field({ name: "DelayedActionTime", id: 1, type: "uint32", conformance: "M" })
  ),
  Command(
    {
      name: "NotifyUpdateApplied",
      id: 4,
      access: "O",
      conformance: "M",
      direction: "request",
      response: "status"
    },
    Field({ name: "UpdateToken", id: 0, type: "octstr", conformance: "M", constraint: "8 to 32" }),
    Field({ name: "SoftwareVersion", id: 1, type: "uint32", conformance: "M" })
  ),
  Datatype(
    { name: "StatusEnum", type: "enum8" },
    Field({ name: "UpdateAvailable", id: 0, conformance: "M" }),
    Field({ name: "Busy", id: 1, conformance: "M" }),
    Field({ name: "NotAvailable", id: 2, conformance: "M" }),
    Field({ name: "DownloadProtocolNotSupported", id: 3, conformance: "M" })
  ),
  Datatype(
    { name: "ApplyUpdateActionEnum", type: "enum8" },
    Field({ name: "Proceed", id: 0, conformance: "M" }),
    Field({ name: "AwaitNextAction", id: 1, conformance: "M" }),
    Field({ name: "Discontinue", id: 2, conformance: "M" })
  ),
  Datatype(
    { name: "DownloadProtocolEnum", type: "enum8" },
    Field({ name: "BdxSynchronous", id: 0, conformance: "M" }),
    Field({ name: "BdxAsynchronous", id: 1, conformance: "O" }),
    Field({ name: "Https", id: 2, conformance: "O" }),
    Field({ name: "VendorSpecific", id: 3, conformance: "O" })
  )
);
MatterDefinition.children.push(OtaSoftwareUpdateProvider);
export {
  OtaSoftwareUpdateProvider
};
//# sourceMappingURL=ota-software-update-provider.element.js.map
