/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { ClusterModel } from "@matter/model";
import { BitSchema, TypeFromPartialBitSchema } from "../schema/BitmapSchema.js";
import { TlvSchema } from "../tlv/TlvSchema.js";
import { Attribute, Command, Event } from "./RetiredElements.js";
/**
 * Types and utilities for the deprecated ClusterType factory.
 *
 * @deprecated Remove when ClusterType compat layer is dropped.
 */
export declare namespace RetiredClusterType {
    /**
     * Convert a legacy options bag (TLV schemas, AccessLevel enums, boolean flags) into a {@link ClusterModel}.
     */
    export function ModelForOptions(options: Options): ClusterModel;
    /**
     * Input to the retired ClusterType factory.
     *
     * @deprecated
     */
    export type Options<F extends BitSchema = {}> = {
        id: number;
        name: string;
        revision: number;
        features?: F;
        supportedFeatures?: TypeFromPartialBitSchema<F>;
        unknown?: boolean;
        attributes?: Record<string, Attribute<any, any>>;
        commands?: Record<string, Command<any, any, any>>;
        events?: Record<string, Event<any, any>>;
    };
    /**
     * @deprecated Provided for compatibility with external consumers.
     */
    export type AttributeValues<T> = T extends {
        Typing: {
            Attributes: infer A;
        };
    } ? A : {};
    /**
     * @deprecated Provided for compatibility with external consumers.
     */
    export type CommandsOf<T> = T extends {
        Typing: {
            Commands: infer C;
        };
    } ? C : {};
    /**
     * Extract {@link ClusterTyping} from an {@link Options} bag.
     *
     * Derives value types directly from the TLV schemas in the options without the component-merging machinery.
     */
    export type TypingOfOptions<T extends Options> = {
        Attributes: AttrValuesOf<T["attributes"] extends {} ? T["attributes"] : {}>;
        Commands: CmdValuesOf<T["commands"] extends {} ? T["commands"] : {}>;
        Events: EventValuesOf<T["events"] extends {} ? T["events"] : {}>;
        Features: FeatureNamesOf<T["features"] extends {} ? T["features"] : {}>;
        SupportedFeatures: T["supportedFeatures"] extends {} ? T["supportedFeatures"] : {};
        Components: [
            {
                flags: {};
                attributes: AttrInterfaceOf<T["attributes"] extends {} ? T["attributes"] : {}>;
                events: EventInterfaceOf<T["events"] extends {} ? T["events"] : {}>;
            }
        ];
    };
    type AttrValueOf<A> = A extends {
        schema: TlvSchema<infer T>;
    } ? T : never;
    type AttrValuesOf<R> = {
        [K in keyof R]: AttrValueOf<R[K]>;
    };
    type EventValuesOf<R> = {
        [K in keyof R]: AttrValueOf<R[K]>;
    };
    type CmdFnOf<C> = C extends {
        requestSchema: TlvSchema<infer Req>;
        responseSchema: TlvSchema<infer Resp>;
    } ? Req extends void ? () => Resp : (request: Req) => Resp : () => void;
    type CmdValuesOf<R> = {
        [K in keyof R]: CmdFnOf<R[K]>;
    };
    type FeatureNamesOf<F> = Capitalize<keyof F & string>;
    /**
     * Attribute keys that are mandatory (not optional).
     */
    type MandatoryAttrKeys<R> = {
        [K in keyof R & string]: R[K] extends {
            optional: true;
        } ? never : K;
    }[keyof R & string];
    /**
     * Attribute keys that are optional.
     */
    type OptionalAttrKeys<R> = {
        [K in keyof R & string]: R[K] extends {
            optional: true;
        } ? K : never;
    }[keyof R & string];
    /**
     * Build a per-component attribute interface from legacy attributes.
     *
     * Mandatory attributes are required; optional attributes use `?`.
     */
    type AttrInterfaceOf<R> = {
        [K in MandatoryAttrKeys<R>]: AttrValueOf<R[K]>;
    } & {
        [K in OptionalAttrKeys<R>]?: AttrValueOf<R[K]>;
    };
    /**
     * Build a per-component event interface from legacy events.
     *
     * Mandatory events are required; optional events use `?`.
     */
    type EventInterfaceOf<R> = {
        [K in MandatoryAttrKeys<R>]: AttrValueOf<R[K]>;
    } & {
        [K in OptionalAttrKeys<R>]?: AttrValueOf<R[K]>;
    };
    export {};
}
//# sourceMappingURL=RetiredClusterType.d.ts.map