import type { OptionallyStatefulCommandEntityDiscovery } from "./BaseEntityDiscovery.ts";

export interface LockDiscovery extends OptionallyStatefulCommandEntityDiscovery {
    /**
     * A regular expression to validate a supplied code when it is set during the service call 
     * to `open`, `lock` or `unlock`.
     */
    code_format?: string;

    /**
     * The lock command template accepts the parameters value and code. 
     * The value parameter will contain the configured value for either payload_open, payload_lock or payload_unlock. 
     * The code parameter is set during the service call to open, lock or unlock the MQTT lock and will be set None if no code was passed.
     */
    command_template?: string;

    /**
     * Flag that defines if the lock works in optimistic mode.
     */
    optimistic?: boolean;

    /**
     * The payload sent to `command_topic` to lock the device.
     * @defaultValue 'LOCK'
     */
    payload_lock?: string;

    /**
     * The payload sent to `command_topic` to unlock the device.
     * @defaultValue 'UNLOCK'
     */ 
    payload_unlock?: string;

    /**
     * The payload sent to `command_topic` to open the device.
     * @defaultValue 'OPEN'
     */
    payload_open?: string;

    /**
     * A special payload that resets the state to `unknown` when received on `state_topic`.
     */
    payload_reset?: string;

    /**
     * The payload sent to `state_topic` when the device is jammed.
     * @defaultValue 'JAMMED'
     */
    state_jammed?: string;

    /**
     * The payload sent to `state_topic` when the device is locked.
     * @defaultValue 'LOCKED'
     */
    state_locked?: string;

    /**
     * The payload sent to `state_topic` when the device is locking.
     * @defaultValue 'LOCKING'
     */
    state_locking?: string;

    /**
     * The payload sent to `state_topic` when the device is unlocked.
     * @defaultValue 'UNLOCKED'
     */
    state_unlocked?: string;

    /**
     * The payload sent to `state_topic` when the device is unlocking.
     * @defaultValue 'UNLOCKING'
     */
    state_unlocking?: string;
}