// admin/data.jsx — platform super-admin mock data: tenants + admins.

const PLANS = {
  commission: { label: 'Commission', sub: '18% take rate', billing: 'Commission' },
  starter:    { label: 'Starter',    sub: '199 zł / mo',  billing: 'Subscription' },
  pro:        { label: 'Pro',        sub: '399 zł / mo',  billing: 'Subscription' },
  enterprise: { label: 'Enterprise', sub: '899 zł / mo',  billing: 'Subscription' },
};
const TStatus = {
  active:    { label: 'Active',    badge: 'success' },
  suspended: { label: 'Suspended', badge: 'danger' },
};
const PLN = (n) => new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format(Math.round(n));
const zl = (n) => `${PLN(n)} zł`;

// roles
const ROLE = { owner: 'Owner', manager: 'Manager' };

let TENANTS = [];

const PLATFORM_USER = { name: 'Carfello Admin', initials: 'CA', role: 'Super admin', email: 'admin@carfello.app' };

let _seq = 1043;
let _aseq = 100;
const newTenantId = () => 'T-' + (++_seq);
const newAdminId = () => 'a' + (++_aseq);
const initialsOf = (name) => (name || '?').trim().split(/\s+/).map((w) => w[0]).slice(0, 2).join('').toUpperCase();

window.AdminData = {
  PLANS, TStatus, ROLE, PLN, zl,
  get TENANTS() { return TENANTS; },
  setTenants: (t) => { TENANTS = t; },
  PLATFORM_USER, newTenantId, newAdminId, initialsOf,
};
