CREATE TABLE IF NOT EXISTS ai_tool_auth (
    session UUID NOT NULL,
    tool_call_id VARCHAR(255) NOT NULL,
    method VARCHAR(255) NOT NULL,
    arguments TEXT NOT NULL,
    decision BOOLEAN NOT NULL DEFAULT false,
    reason VARCHAR(255) NOT NULL,
    decision_by UUID NOT NULL,
    decision_comment TEXT,
    logs JSONB NOT NULL,
    expires_at TIMESTAMPTZ,
    authorized_at TIMESTAMPTZ,
    created_at TIMESTAMPTZ NOT NULL,
    updated_at TIMESTAMPTZ NOT NULL,
    PRIMARY KEY (session, tool_call_id)
);
