-- Replace the sample values below with real deliverable inboxes before running this file.
-- Placeholder domains such as acme.com or *.local will not receive Supabase magic links.

insert into public.companies (name, slug)
values ('Acme Formation', 'acme-formation')
on conflict (slug) do update
set name = excluded.name;

insert into public.company_members (company_id, email, full_name, role, status)
select
  companies.id,
  'admin@acme.com',
  'Admin principal',
  'admin',
  'active'
from public.companies
where companies.slug = 'acme-formation'
on conflict (company_id, email) do update
set
  full_name = excluded.full_name,
  role = excluded.role,
  status = excluded.status;

insert into public.platform_admins (email, full_name, status)
values ('admin@acme.com', 'Admin principal', 'active')
on conflict (email) do update
set
  full_name = excluded.full_name,
  status = excluded.status;

insert into public.company_members (company_id, email, full_name, role, status)
select
  companies.id,
  'learner@acme.com',
  'Participant exemple',
  'learner',
  'active'
from public.companies
where companies.slug = 'acme-formation'
on conflict (company_id, email) do update
set
  full_name = excluded.full_name,
  role = excluded.role,
  status = excluded.status;
