/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */

/*** THIS FILE IS GENERATED, DO NOT EDIT ***/

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";

export const WebRtcTransportProvider = Cluster(
    { name: "WebRtcTransportProvider", id: 0x553, classification: "application" },
    Attribute({ name: "ClusterRevision", id: 0xfffd, type: "ClusterRevision", default: 2 }),
    Attribute(
        { name: "FeatureMap", id: 0xfffc, type: "FeatureMap" },
        Field({ name: "METADATA", conformance: "P, O", constraint: "0", title: "Metadata" })
    ),
    Attribute(
        { name: "CurrentSessions", id: 0x0, type: "list", access: "R S M", conformance: "M" },
        Field({ name: "entry", type: "WebRtcTransportDefinitions.WebRTCSessionStruct" })
    ),

    Command(
        {
            name: "SolicitOffer", id: 0x0, access: "F O", conformance: "M", direction: "request", quality: "L",
            response: "SolicitOfferResponse"
        },
        Field({ name: "StreamUsage", id: 0x0, type: "StreamUsageEnum", conformance: "M" }),
        Field({ name: "OriginatingEndpointId", id: 0x1, type: "endpoint-no", conformance: "M" }),
        Field({
            name: "VideoStreamId", id: 0x2, type: "CameraAvStreamManagement.VideoStreamID", conformance: "O, D",
            quality: "X"
        }),
        Field({
            name: "AudioStreamId", id: 0x3, type: "CameraAvStreamManagement.AudioStreamID", conformance: "O, D",
            quality: "X"
        }),
        Field(
            { name: "IceServers", id: 0x4, type: "list", conformance: "O", constraint: "max 10" },
            Field({ name: "entry", type: "WebRtcTransportDefinitions.ICEServerStruct" })
        ),
        Field({ name: "IceTransportPolicy", id: 0x5, type: "string", conformance: "O", constraint: "max 16" }),
        Field({ name: "MetadataEnabled", id: 0x6, type: "bool", conformance: "METADATA" }),
        Field({ name: "SFrameConfig", id: 0x7, type: "SFrameStruct", conformance: "P, O" }),
        Field(
            { name: "VideoStreams", id: 0x8, type: "list", conformance: "[Rev >= v2].b+, O", constraint: "1 to 16" },
            Field({ name: "entry", type: "CameraAvStreamManagement.VideoStreamID" })
        ),
        Field(
            { name: "AudioStreams", id: 0x9, type: "list", conformance: "[Rev >= v2].b+, O", constraint: "1 to 16" },
            Field({ name: "entry", type: "CameraAvStreamManagement.AudioStreamID" })
        )
    ),

    Command(
        { name: "SolicitOfferResponse", id: 0x1, conformance: "M", direction: "response", quality: "L" },
        Field({ name: "WebRtcSessionId", id: 0x0, type: "WebRtcTransportDefinitions.WebRTCSessionID", conformance: "M" }),
        Field({ name: "DeferredOffer", id: 0x1, type: "bool", conformance: "M" }),
        Field({
            name: "VideoStreamId", id: 0x2, type: "CameraAvStreamManagement.VideoStreamID",
            conformance: "SolicitOffer.VideoStreamID, D", quality: "X"
        }),
        Field({
            name: "AudioStreamId", id: 0x3, type: "CameraAvStreamManagement.AudioStreamID",
            conformance: "SolicitOffer.AudioStreamID, D", quality: "X"
        })
    ),

    Command(
        {
            name: "ProvideOffer", id: 0x2, access: "F O", conformance: "M", direction: "request", quality: "L",
            response: "ProvideOfferResponse"
        },
        Field({
            name: "WebRtcSessionId", id: 0x0, type: "WebRtcTransportDefinitions.WebRTCSessionID",
            conformance: "M", quality: "X"
        }),
        Field({ name: "Sdp", id: 0x1, type: "string", conformance: "M" }),
        Field({ name: "StreamUsage", id: 0x2, type: "StreamUsageEnum", conformance: "WebRTCSessionID == null, O" }),
        Field({ name: "OriginatingEndpointId", id: 0x3, type: "endpoint-no", conformance: "WebRTCSessionID == null, O" }),
        Field({
            name: "VideoStreamId", id: 0x4, type: "CameraAvStreamManagement.VideoStreamID", conformance: "O, D",
            quality: "X"
        }),
        Field({
            name: "AudioStreamId", id: 0x5, type: "CameraAvStreamManagement.AudioStreamID", conformance: "O, D",
            quality: "X"
        }),
        Field(
            { name: "IceServers", id: 0x6, type: "list", conformance: "O", constraint: "max 10" },
            Field({ name: "entry", type: "WebRtcTransportDefinitions.ICEServerStruct" })
        ),
        Field({ name: "IceTransportPolicy", id: 0x7, type: "string", conformance: "O", constraint: "max 16" }),
        Field({ name: "MetadataEnabled", id: 0x8, type: "bool", conformance: "METADATA & WebRTCSessionID == null" }),
        Field({ name: "SFrameConfig", id: 0x9, type: "SFrameStruct", conformance: "P, O" }),

        Field(
            {
                name: "VideoStreams", id: 0xa, type: "list",
                conformance: "[Rev >= v2 & WebRTCSessionID == null].d+, O", constraint: "1 to 16"
            },
            Field({ name: "entry", type: "CameraAvStreamManagement.VideoStreamID" })
        ),

        Field(
            {
                name: "AudioStreams", id: 0xb, type: "list",
                conformance: "[Rev >= v2 & WebRTCSessionID == null].d+, O", constraint: "1 to 16"
            },
            Field({ name: "entry", type: "CameraAvStreamManagement.AudioStreamID" })
        )
    ),

    Command(
        { name: "ProvideOfferResponse", id: 0x3, conformance: "M", direction: "response", quality: "L" },
        Field({ name: "WebRtcSessionId", id: 0x0, type: "WebRtcTransportDefinitions.WebRTCSessionID", conformance: "M" }),
        Field({
            name: "VideoStreamId", id: 0x1, type: "CameraAvStreamManagement.VideoStreamID",
            conformance: "ProvideOffer.VideoStreamID, D", quality: "X"
        }),
        Field({
            name: "AudioStreamId", id: 0x2, type: "CameraAvStreamManagement.AudioStreamID",
            conformance: "ProvideOffer.AudioStreamID, D", quality: "X"
        })
    ),

    Command(
        {
            name: "ProvideAnswer", id: 0x4, access: "F O", conformance: "M", direction: "request", quality: "L",
            response: "status"
        },
        Field({ name: "WebRtcSessionId", id: 0x0, type: "WebRtcTransportDefinitions.WebRTCSessionID", conformance: "M" }),
        Field({ name: "Sdp", id: 0x1, type: "string", conformance: "M" })
    ),

    Command(
        {
            name: "ProvideIceCandidates", id: 0x5, access: "F O", conformance: "M", direction: "request",
            quality: "L", response: "status"
        },
        Field({ name: "WebRtcSessionId", id: 0x0, type: "WebRtcTransportDefinitions.WebRTCSessionID", conformance: "M" }),
        Field(
            { name: "IceCandidates", id: 0x1, type: "list", conformance: "M", constraint: "min 1" },
            Field({ name: "entry", type: "WebRtcTransportDefinitions.ICECandidateStruct" })
        )
    ),

    Command(
        {
            name: "EndSession", id: 0x6, access: "F O", conformance: "M", direction: "request", quality: "L",
            response: "status"
        },
        Field({ name: "WebRtcSessionId", id: 0x0, type: "WebRtcTransportDefinitions.WebRTCSessionID", conformance: "M" }),
        Field({ name: "Reason", id: 0x1, type: "WebRtcTransportDefinitions.WebRTCEndReasonEnum", conformance: "M" })
    ),

    Datatype(
        { name: "SFrameStruct", type: "struct" },
        Field({ name: "CipherSuite", id: 0x0, type: "uint16", conformance: "M", constraint: "min 1" }),
        Field({ name: "BaseKey", id: 0x1, type: "octstr", conformance: "M", constraint: "max 128" }),
        Field({ name: "Kid", id: 0x2, type: "octstr", conformance: "M", constraint: "2 to 8" })
    )
);

MatterDefinition.children.push(WebRtcTransportProvider);
