-- V13: Voice command configs - phrase yang diucapkan user untuk trigger aksi
CREATE TABLE IF NOT EXISTS voice_command_configs (
    id             BIGSERIAL    PRIMARY KEY,
    guardian_id    BIGINT       REFERENCES users(id) ON DELETE SET NULL,
    user_id        BIGINT       NOT NULL REFERENCES users(id) ON DELETE CASCADE,
    command_key    VARCHAR(50)  NOT NULL,
    trigger_phrase VARCHAR(200) NOT NULL,
    enabled        BOOLEAN      NOT NULL DEFAULT TRUE,
    updated_at     TIMESTAMP    NOT NULL DEFAULT NOW(),
    CONSTRAINT uq_voice_cmd_user_key UNIQUE (user_id, command_key)
);
CREATE INDEX IF NOT EXISTS idx_voice_cmd_user_id ON voice_command_configs(user_id);
