Skip to main content
Base path: /organization

Types

// ============ Enums ============

type OrgType = 'government' | 'enterprise' | 'individual' | 'education' | 'ngo';

type OrgPlan = 'trial' | 'starter' | 'pro' | 'enterprise';

type OrgSize = '1-10' | '11-50' | '51-200' | '500+';

type OrgPrimaryUse = 'sales' | 'support' | 'market research';

type OrgStatus = 'active' | 'suspended' | 'inactive';

// ============ Request Types ============

interface CreateOrganizationRequest {
  country: string;         // ISO 3166-1 alpha-2 (e.g., 'MA')
  timezone: string;        // IANA timezone (e.g., 'Africa/Casablanca')
  currency: string;        // ISO 4217 (e.g., 'MAD')
  ice?: string;            // exactly 15 characters
  name: string;            // 3-64 characters
  type: OrgType;
  industry: string;        // 3-64 characters
  plan?: OrgPlan;
  primaryUse: OrgPrimaryUse;
  size: OrgSize;
  status?: OrgStatus;
  slug: string;            // 1-256 characters
}

interface UpdateOrganizationRequest {
  country?: string;        // ISO 3166-1 alpha-2
  timezone?: string;       // IANA timezone
  currency?: string;       // ISO 4217
  name?: string;           // 1-128 characters
  type?: OrgType;
  industry?: string;       // 3-128 characters
  primaryUse?: OrgPrimaryUse;
  size?: OrgSize;
  status?: OrgStatus;
}

interface UpdateIceRequest {
  ice: string;             // exactly 15 characters
}

interface UpdateSlugRequest {
  slug: string;            // 1-256 characters
}

interface UpdateOrganizationPlanRequest {
  plan: OrgPlan;
}

// ============ Response Types ============

interface OrganizationResponse {
  id: string;
  name: string;
  country: string;
  type: OrgType;
  industry: string;
  plan: OrgPlan;
  size: OrgSize;
  primaryUse: OrgPrimaryUse;
  ice: string | null;
  timezone: string;
  slug: string;
  currency: string;
  status: OrgStatus;
  createdAt: string;       // ISO date
  updatedAt: string;       // ISO date
  deletedAt: string | null;
  createdBy: string | null;
  updatedBy: string | null;
  deletedBy: string | null;
}