/**
 * Shared types for signup workflow services
 */

/**
 * Snapshot of a Salesforce account for signup purposes
 */
export interface SignupAccountSnapshot {
  id: string;
  Name?: string | null | undefined;
  WH_Account__c?: string | null | undefined;
}

/**
 * Cache entry structure for account snapshots
 */
export interface SignupAccountCacheEntry {
  value: SignupAccountSnapshot | null;
  __signupCache: true;
}

/**
 * Result of signup preflight check
 */
export interface SignupPreflightResult {
  canProceed: boolean;
  nextAction:
    | "login"
    | "proceed_signup"
    | "link_whmcs"
    | "fix_input"
    | "blocked"
    | "complete_account"
    | null;
  messages: string[];
  normalized: {
    email: string;
  };
  portal: {
    userExists: boolean;
    needsPasswordSet?: boolean | undefined;
  };
  salesforce: {
    accountId?: string | undefined;
    alreadyMapped: boolean;
  };
  whmcs: {
    clientExists: boolean;
    clientId?: number | undefined;
  };
}
