-- ============================================================
-- AeThex Bot — Roblox Integration Tables
-- Run in Supabase SQL editor
-- ============================================================

-- Per-server Roblox config (set via /config roblox)
create table if not exists roblox_server_configs (
  id             uuid default gen_random_uuid() primary key,
  guild_id       text unique not null,
  universe_id    text not null,
  open_cloud_key text not null,
  roblox_group_id text,
  created_at     timestamptz default now(),
  updated_at     timestamptz default now()
);

-- Roblox mod action log (game bans/unbans per server)
create table if not exists roblox_mod_logs (
  id                uuid default gen_random_uuid() primary key,
  guild_id          text not null,
  type              text not null,        -- ban | unban | kick
  target_username   text,
  target_roblox_id  bigint,
  reason            text,
  duration_seconds  int default 0,
  mod_discord_id    text,
  mod_username      text,
  created_at        timestamptz default now()
);

alter table roblox_server_configs disable row level security;
alter table roblox_mod_logs       disable row level security;
