import type { TBlackHole, TContext } from "@digital-alchemy/core"; import type { TRawDomains } from "@digital-alchemy/hass"; import type { EmptyObject } from "type-fest"; import type { EntityConfigCommon, NonReactive } from "./common-config.mts"; import type { TSynapseId } from "./utility.mts"; export type RemovableCallback = (data: DATA, remove: () => void) => TBlackHole; export type TSerialize = { serialize: (property: keyof CONFIGURATION, data: SERIALIZE_TYPES, options: CONFIGURATION) => string; unserialize: (property: keyof CONFIGURATION, data: string, options: CONFIGURATION) => SERIALIZE_TYPES; }; export type CreateRemovableCallback = (callback: RemovableCallback) => { remove: () => void; }; export type DomainGeneratorOptions, SERIALIZE_TYPES extends unknown = unknown> = { /** * The domain to map the code to on the python side */ domain: TRawDomains; /** * Context of the synapse extension generating */ context: TContext; /** * Bus Transfer events */ bus_events?: Extract[]; /** * Keys to map from `add_entity` options -> `proxy.configuration` */ load_config_keys?: Extract[]; /** * What to use instead of `undefined` / `None` */ default_config?: Partial; /** * run as part of the setter process * * ensure that data is valid before handing off to internals */ validate?: (current: CONFIGURATION, key: keyof CONFIGURATION, value: unknown) => void | never; } & (TSerialize | EmptyObject); export type TEventMap = Record; export type AddEntityOptions, ATTRIBUTES extends object, LOCALS extends object, DATA extends object> = { context: TContext; } & EntityConfigCommon & CONFIGURATION & Partial<{ [EVENT in keyof EVENT_MAP]: RemovableCallback; }>; export declare function generateHash(input: string): string; export type BaseEvent = { data: { unique_id: TSynapseId; }; }; export declare const formatObjectId: (input: string) => string; export declare const LATE_READY = -1; export type CallbackData = { locals: LOCALS; attributes: ATTRIBUTES; } & NonReactive>;