# SPDX-License-Identifier: GPL-2.0-only
# This file is part of Scapy RPC
# See https://scapy.net/ for more information
# Copyright (C) Gabriel Potter

# [ms-adts] v64.0 (Wed, 12 Nov 2025)

"""
RPC definitions for the following interfaces:
-
This file is auto-generated by midl-to-scapy, do not modify.
"""

from enum import IntEnum
import uuid

from scapy.fields import StrFixedLenField
from scapy.layers.dcerpc import (
    NDRPacket,
    NDRConfFieldListField,
    NDRConfPacketListField,
    NDRConfStrLenField,
    NDRConfVarStrNullField,
    NDRConfVarStrNullFieldUtf16,
    NDRFullEmbPointerField,
    NDRInt3264EnumField,
    NDRIntField,
    NDRLongField,
    NDRPacketField,
    NDRShortField,
    NDRSignedLongField,
    NDRUnionField,
)


class CLAIM_TYPE(IntEnum):
    CLAIM_TYPE_INT64 = 1
    CLAIM_TYPE_UINT64 = 2
    CLAIM_TYPE_STRING = 3
    CLAIM_TYPE_BOOLEAN = 6


class PCLAIM_TYPE(IntEnum):
    CLAIM_TYPE_INT64 = 1
    CLAIM_TYPE_UINT64 = 2
    CLAIM_TYPE_STRING = 3
    CLAIM_TYPE_BOOLEAN = 6


class CLAIMS_SOURCE_TYPE(IntEnum):
    CLAIMS_SOURCE_TYPE_AD = 1
    CLAIMS_SOURCE_TYPE_CERTIFICATE = 2


class CLAIMS_COMPRESSION_FORMAT(IntEnum):
    COMPRESSION_FORMAT_NONE = 0
    COMPRESSION_FORMAT_LZNT1 = 2
    COMPRESSION_FORMAT_XPRESS = 3
    COMPRESSION_FORMAT_XPRESS_HUFF = 4


class u_sub0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ValueCount", None, size_of="Int64Values"),
        NDRFullEmbPointerField(
            NDRConfFieldListField(
                "Int64Values",
                [],
                NDRSignedLongField("", 0),
                size_is=lambda pkt: pkt.ValueCount,
            )
        ),
    ]


class u_sub1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ValueCount", None, size_of="Uint64Values"),
        NDRFullEmbPointerField(
            NDRConfFieldListField(
                "Uint64Values",
                [],
                NDRLongField("", 0),
                size_is=lambda pkt: pkt.ValueCount,
            )
        ),
    ]


class u_sub2(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ValueCount", None, size_of="StringValues"),
        NDRFullEmbPointerField(
            NDRConfFieldListField(
                "StringValues",
                [],
                NDRFullEmbPointerField(NDRConfVarStrNullFieldUtf16("", "")),
                size_is=lambda pkt: pkt.ValueCount,
            )
        ),
    ]


class u_sub3(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ValueCount", None, size_of="BooleanValues"),
        NDRFullEmbPointerField(
            NDRConfFieldListField(
                "BooleanValues",
                [],
                NDRLongField("", 0),
                size_is=lambda pkt: pkt.ValueCount,
            )
        ),
    ]


class CLAIM_ENTRY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullEmbPointerField(NDRConfVarStrNullFieldUtf16("Id", "")),
        NDRInt3264EnumField("Type", 0, CLAIM_TYPE),
        NDRUnionField(
            [
                (
                    NDRPacketField("Values", u_sub0(), u_sub0),
                    (
                        (
                            lambda pkt: getattr(pkt, "Type", None)
                            == CLAIM_TYPE.CLAIM_TYPE_INT64
                        ),
                        (lambda _, val: val.tag == CLAIM_TYPE.CLAIM_TYPE_INT64),
                    ),
                ),
                (
                    NDRPacketField("Values", u_sub1(), u_sub1),
                    (
                        (
                            lambda pkt: getattr(pkt, "Type", None)
                            == CLAIM_TYPE.CLAIM_TYPE_UINT64
                        ),
                        (lambda _, val: val.tag == CLAIM_TYPE.CLAIM_TYPE_UINT64),
                    ),
                ),
                (
                    NDRPacketField("Values", u_sub2(), u_sub2),
                    (
                        (
                            lambda pkt: getattr(pkt, "Type", None)
                            == CLAIM_TYPE.CLAIM_TYPE_STRING
                        ),
                        (lambda _, val: val.tag == CLAIM_TYPE.CLAIM_TYPE_STRING),
                    ),
                ),
                (
                    NDRPacketField("Values", u_sub3(), u_sub3),
                    (
                        (
                            lambda pkt: getattr(pkt, "Type", None)
                            == CLAIM_TYPE.CLAIM_TYPE_BOOLEAN
                        ),
                        (lambda _, val: val.tag == CLAIM_TYPE.CLAIM_TYPE_BOOLEAN),
                    ),
                ),
            ],
            StrFixedLenField("Values", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
    ]


class u_sub0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ValueCount", None, size_of="Int64Values"),
        NDRFullEmbPointerField(
            NDRConfFieldListField(
                "Int64Values",
                [],
                NDRSignedLongField("", 0),
                size_is=lambda pkt: pkt.ValueCount,
            )
        ),
    ]


class u_sub1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ValueCount", None, size_of="Uint64Values"),
        NDRFullEmbPointerField(
            NDRConfFieldListField(
                "Uint64Values",
                [],
                NDRLongField("", 0),
                size_is=lambda pkt: pkt.ValueCount,
            )
        ),
    ]


class u_sub2(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ValueCount", None, size_of="StringValues"),
        NDRFullEmbPointerField(
            NDRConfFieldListField(
                "StringValues",
                [],
                NDRFullEmbPointerField(NDRConfVarStrNullFieldUtf16("", "")),
                size_is=lambda pkt: pkt.ValueCount,
            )
        ),
    ]


class u_sub3(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ValueCount", None, size_of="BooleanValues"),
        NDRFullEmbPointerField(
            NDRConfFieldListField(
                "BooleanValues",
                [],
                NDRLongField("", 0),
                size_is=lambda pkt: pkt.ValueCount,
            )
        ),
    ]


class PCLAIM_ENTRY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullEmbPointerField(NDRConfVarStrNullFieldUtf16("Id", "")),
        NDRInt3264EnumField("Type", 0, CLAIM_TYPE),
        NDRUnionField(
            [
                (
                    NDRPacketField("Values", u_sub0(), u_sub0),
                    (
                        (
                            lambda pkt: getattr(pkt, "Type", None)
                            == CLAIM_TYPE.CLAIM_TYPE_INT64
                        ),
                        (lambda _, val: val.tag == CLAIM_TYPE.CLAIM_TYPE_INT64),
                    ),
                ),
                (
                    NDRPacketField("Values", u_sub1(), u_sub1),
                    (
                        (
                            lambda pkt: getattr(pkt, "Type", None)
                            == CLAIM_TYPE.CLAIM_TYPE_UINT64
                        ),
                        (lambda _, val: val.tag == CLAIM_TYPE.CLAIM_TYPE_UINT64),
                    ),
                ),
                (
                    NDRPacketField("Values", u_sub2(), u_sub2),
                    (
                        (
                            lambda pkt: getattr(pkt, "Type", None)
                            == CLAIM_TYPE.CLAIM_TYPE_STRING
                        ),
                        (lambda _, val: val.tag == CLAIM_TYPE.CLAIM_TYPE_STRING),
                    ),
                ),
                (
                    NDRPacketField("Values", u_sub3(), u_sub3),
                    (
                        (
                            lambda pkt: getattr(pkt, "Type", None)
                            == CLAIM_TYPE.CLAIM_TYPE_BOOLEAN
                        ),
                        (lambda _, val: val.tag == CLAIM_TYPE.CLAIM_TYPE_BOOLEAN),
                    ),
                ),
            ],
            StrFixedLenField("Values", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
    ]


class CLAIMS_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRInt3264EnumField("usClaimsSourceType", 0, CLAIMS_SOURCE_TYPE),
        NDRIntField("ulClaimsCount", None, size_of="ClaimEntries"),
        NDRFullEmbPointerField(
            NDRConfPacketListField(
                "ClaimEntries", [], PCLAIM_ENTRY, size_is=lambda pkt: pkt.ulClaimsCount
            )
        ),
    ]


class PCLAIMS_ARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRInt3264EnumField("usClaimsSourceType", 0, CLAIMS_SOURCE_TYPE),
        NDRIntField("ulClaimsCount", None, size_of="ClaimEntries"),
        NDRFullEmbPointerField(
            NDRConfPacketListField(
                "ClaimEntries", [], PCLAIM_ENTRY, size_is=lambda pkt: pkt.ulClaimsCount
            )
        ),
    ]


class CLAIMS_SET(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ulClaimsArrayCount", None, size_of="ClaimsArrays"),
        NDRFullEmbPointerField(
            NDRConfPacketListField(
                "ClaimsArrays",
                [],
                PCLAIMS_ARRAY,
                size_is=lambda pkt: pkt.ulClaimsArrayCount,
            )
        ),
        NDRShortField("usReservedType", 0),
        NDRIntField("ulReservedFieldSize", None, size_of="ReservedField"),
        NDRFullEmbPointerField(
            NDRConfStrLenField(
                "ReservedField", "", size_is=lambda pkt: pkt.ulReservedFieldSize
            )
        ),
    ]


class PCLAIMS_SET(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ulClaimsArrayCount", None, size_of="ClaimsArrays"),
        NDRFullEmbPointerField(
            NDRConfPacketListField(
                "ClaimsArrays",
                [],
                PCLAIMS_ARRAY,
                size_is=lambda pkt: pkt.ulClaimsArrayCount,
            )
        ),
        NDRShortField("usReservedType", 0),
        NDRIntField("ulReservedFieldSize", None, size_of="ReservedField"),
        NDRFullEmbPointerField(
            NDRConfStrLenField(
                "ReservedField", "", size_is=lambda pkt: pkt.ulReservedFieldSize
            )
        ),
    ]


class CLAIMS_SET_METADATA(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ulClaimsSetSize", None, size_of="ClaimsSet"),
        NDRFullEmbPointerField(
            NDRConfStrLenField("ClaimsSet", "", size_is=lambda pkt: pkt.ulClaimsSetSize)
        ),
        NDRInt3264EnumField("usCompressionFormat", 0, CLAIMS_COMPRESSION_FORMAT),
        NDRIntField("ulUncompressedClaimsSetSize", 0),
        NDRShortField("usReservedType", 0),
        NDRIntField("ulReservedFieldSize", None, size_of="ReservedField"),
        NDRFullEmbPointerField(
            NDRConfStrLenField(
                "ReservedField", "", size_is=lambda pkt: pkt.ulReservedFieldSize
            )
        ),
    ]


class PCLAIMS_SET_METADATA(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ulClaimsSetSize", None, size_of="ClaimsSet"),
        NDRFullEmbPointerField(
            NDRConfStrLenField("ClaimsSet", "", size_is=lambda pkt: pkt.ulClaimsSetSize)
        ),
        NDRInt3264EnumField("usCompressionFormat", 0, CLAIMS_COMPRESSION_FORMAT),
        NDRIntField("ulUncompressedClaimsSetSize", 0),
        NDRShortField("usReservedType", 0),
        NDRIntField("ulReservedFieldSize", None, size_of="ReservedField"),
        NDRFullEmbPointerField(
            NDRConfStrLenField(
                "ReservedField", "", size_is=lambda pkt: pkt.ulReservedFieldSize
            )
        ),
    ]
