CREATE TABLE IF NOT EXISTS monitored_services (
    id         UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
    name       VARCHAR(200) NOT NULL,
    url        VARCHAR(500) NOT NULL,
    type       VARCHAR(20) NOT NULL DEFAULT 'custom' CHECK (type IN ('internal','custom')),
    is_active  BOOLEAN NOT NULL DEFAULT TRUE,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE OR REPLACE TRIGGER update_monitored_services_updated_at
    BEFORE UPDATE ON monitored_services
    FOR EACH ROW EXECUTE FUNCTION update_updated_at_column();
