export const CRM_MASTER_OPTION_CATEGORIES = [
  'crm_branch',
  'crm_customer_status',
  'crm_customer_type',
  'crm_enquiry_status',
  'crm_quotation_status',
  'crm_quotation_type',
  'crm_discount_type',
  'crm_unit',
  'crm_sent_via',
  'crm_project_party_role',
  'crm_quotation_topic_type',
  'crm_product_type',
  'crm_currency',
  'crm_payment_term',
  'crm_priority',
  'crm_lead_channel'
] as const;

export type CrmMasterOptionCategory = (typeof CRM_MASTER_OPTION_CATEGORIES)[number];

export interface MasterOptionRecord {
  id: string;
  organizationId: string;
  category: string;
  code: string;
  label: string;
  value: string | null;
  parentId: string | null;
  parentLabel: string | null;
  sortOrder: number;
  isActive: boolean;
  metadata: Record<string, unknown> | null;
  deletedAt: string | null;
  createdAt: string;
  updatedAt: string;
}

export interface MasterOptionNode extends MasterOptionRecord {
  children: MasterOptionNode[];
}

export interface MasterOptionListFilters {
  organizationId?: string;
  category?: string;
  search?: string;
  page?: number;
  limit?: number;
  sort?: string;
  activeOnly?: boolean;
  includeDeleted?: boolean;
}

export interface MasterOptionListResult {
  items: MasterOptionRecord[];
  totalItems: number;
}
