-- Seed: membership plans (Basic / Premium / Enterprise)

INSERT INTO plans (
  code, name, teachers_limit, students_limit, price_label, features_json, worlds_json, is_active
) VALUES
  (
    'basic',
    'Basic',
    10,
    100,
    'Starter',
    '["Math Kingdom & Language Forest","Teacher dashboard & reports","Core learning worlds"]'::jsonb,
    '["Math Kingdom","Language Forest"]'::jsonb,
    TRUE
  ),
  (
    'premium',
    'Premium',
    25,
    400,
    'Recommended',
    '["All learning worlds","Teacher dashboard & reports","Class analysis & recommendations","Priority support"]'::jsonb,
    '["Math Kingdom","Language Forest","World Discovery","Creative Island","Play Island"]'::jsonb,
    TRUE
  ),
  (
    'enterprise',
    'Enterprise',
    50,
    1000,
    'Custom',
    '["Custom teacher & student limits","All learning worlds","Multi-school management","Dedicated onboarding","Priority support"]'::jsonb,
    '["Math Kingdom","Language Forest","World Discovery","Creative Island","Play Island"]'::jsonb,
    TRUE
  )
ON CONFLICT (code) DO UPDATE SET
  name = EXCLUDED.name,
  teachers_limit = EXCLUDED.teachers_limit,
  students_limit = EXCLUDED.students_limit,
  price_label = EXCLUDED.price_label,
  features_json = EXCLUDED.features_json,
  worlds_json = EXCLUDED.worlds_json,
  is_active = TRUE,
  updated_at = NOW();
