-- +goose Up
-- +goose StatementBegin
CREATE TABLE api_services (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),   -- Unique identifier

    -- OIDC-required fields
    client_id TEXT UNIQUE NOT NULL,
    client_secret TEXT NOT NULL, -- Store as hashed value

    -- Metadata
    name TEXT NOT NULL,

    redirect_uris TEXT[] DEFAULT '{}',
    scopes TEXT[] DEFAULT '{openid}',
    grant_types TEXT[] DEFAULT '{authorization_code}',

    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),

    is_active BOOLEAN NOT NULL DEFAULT true
);
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
DROP TABLE api_services;
-- +goose StatementEnd
