CREATE TABLE IF NOT EXISTS enetpulse_sports (
    id BIGSERIAL PRIMARY KEY,
    sport_id VARCHAR(50) NOT NULL UNIQUE,        -- from API "id"
    name VARCHAR(255) NOT NULL,                  -- from API "name"
    updates_count INT DEFAULT 0,                 -- from API "n"
    last_updated_at TIMESTAMPTZ,                 -- from API "ut"
    status INT DEFAULT 1,                        -- optional status (active/inactive)
    created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMPTZ
);

CREATE TABLE IF NOT EXISTS enetpulse_tournament_templates (
    id BIGSERIAL PRIMARY KEY,
    template_id VARCHAR(50) NOT NULL UNIQUE,       -- from API "id"
    name VARCHAR(255) NOT NULL,                    -- from API "name"
    sport_fk VARCHAR(50) NOT NULL REFERENCES enetpulse_sports(sport_id) ON DELETE CASCADE,
    gender VARCHAR(20) DEFAULT 'unknown',         -- from API "gender" {male, female, mixed, unknown}
    updates_count INT DEFAULT 0,                  -- from API "n"
    last_updated_at TIMESTAMPTZ,                  -- from API "ut"
    status INT DEFAULT 1,                          -- optional status (active/inactive)
    created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMPTZ
);
