/**
 * MSP Quote Wizard Types
 */

// ============================================================================
// GPS Monitoring Types
// ============================================================================

export type GPSTierId = 'basic' | 'pro' | 'advanced';

export interface GPSTier {
  id: GPSTierId;
  name: string;
  description: string;
  pricePerEndpoint: number;
  features: string[];
  recommended: boolean;
}

export interface GPSSelection {
  tierId: GPSTierId;
  endpointCount: number;
  includeEquipment: boolean;
  equipmentDeviceCount: number;
}

// ============================================================================
// Support Plan Types
// ============================================================================

export type SupportPlanId = 'none' | 'essential' | 'standard' | 'premium' | 'priority';
export type BlockTimeId = 'block-10' | 'block-20' | 'block-30';

export interface SupportPlan {
  id: SupportPlanId;
  name: string;
  description: string;
  monthlyPrice: number;
  includedHours: number;
  effectiveHourlyRate: number;
  recommended: boolean;
}

export interface BlockTimeOption {
  id: BlockTimeId;
  hours: number;
  price: number;
  effectiveHourlyRate: number;
}

export interface SupportSelection {
  planId: SupportPlanId;
  useBlockTime: boolean;
  blockTimeId: BlockTimeId | null;
}

// ============================================================================
// VoIP Types
// ============================================================================

export type VoIPTierId = 'voip-basic' | 'voip-standard' | 'voip-pro' | 'voip-callcenter';

export interface VoIPTier {
  id: VoIPTierId;
  name: string;
  description: string;
  pricePerUser: number;
  features: string[];
  recommended: boolean;
}

export interface VoIPHardware {
  id: string;
  name: string;
  description: string;
  oneTimePrice: number;
  monthlyRental: number;
}

export interface HardwareSelection {
  hardwareId: string;
  quantity: number;
  isRental: boolean;
}

export interface VoIPSelection {
  enabled: boolean;
  tierId: VoIPTierId;
  userCount: number;
  hardware: HardwareSelection[];
}

// ============================================================================
// Web Hosting Types
// ============================================================================

export type WebHostingTierId = 'hosting-starter' | 'hosting-business' | 'hosting-commerce';

export interface WebHostingTier {
  id: WebHostingTierId;
  name: string;
  description: string;
  monthlyPrice: number;
  storage: string;
  sites: number; // -1 = unlimited
  features: string[];
  recommended: boolean;
}

export interface WebHostingSelection {
  enabled: boolean;
  tierId: WebHostingTierId;
}

// ============================================================================
// Email Types
// ============================================================================

export type EmailProvider = 'whm' | 'm365';
export type EmailTierId = 'whm-basic' | 'whm-standard' | 'whm-pro' | 'm365-basic' | 'm365-standard' | 'm365-premium';

export interface EmailTier {
  id: EmailTierId;
  name: string;
  description: string;
  pricePerMailbox: number;
  provider: EmailProvider;
  storage: string;
  features: string[];
  recommended: boolean;
}

export interface EmailSelection {
  enabled: boolean;
  provider: EmailProvider;
  tierId: EmailTierId;
  mailboxCount: number;
}

// ============================================================================
// Client & Contact Types
// ============================================================================

export type ClientType = 'company' | 'individual';

export type Industry =
  | 'Healthcare'
  | 'Legal'
  | 'Finance'
  | 'Manufacturing'
  | 'Retail'
  | 'Professional Services'
  | 'Other';

export type ContactPreference = 'email' | 'phone' | 'either';

export interface CompanyInfo {
  name: string;
  endpointCount: number;
  industry: Industry | '';
  notes: string;
}

export interface ContactInfo {
  name: string;
  email: string;
  phone: string;
  companyName: string;
  currentITSituation: string;
  contactPreference: ContactPreference;
  agreedToTerms: boolean;
}

// ============================================================================
// Service Interest Selection (for discovery step)
// ============================================================================

export interface ServiceInterests {
  gps: boolean;
  support: boolean;
  voip: boolean;
  webHosting: boolean;
  email: boolean;
}

// ============================================================================
// Quote Data & Result Types
// ============================================================================

export interface QuoteData {
  clientType: ClientType;
  serviceInterests: ServiceInterests;
  company: CompanyInfo;
  gps: GPSSelection;
  support: SupportSelection;
  voip: VoIPSelection;
  webHosting: WebHostingSelection;
  email: EmailSelection;
  contact: ContactInfo;
}

export interface QuoteBreakdown {
  gps: {
    monitoring: number;
    equipment: number;
    total: number;
  };
  support: {
    plan: number;
    blockTime: number;
    total: number;
  };
  voip: {
    service: number;
    hardware: number;
    total: number;
  };
  webHosting: number;
  email: number;
}

export interface QuoteResult {
  monthlyTotal: number;
  oneTimeTotal: number;
  breakdown: QuoteBreakdown;
  gpsMonthly: number;
  supportMonthly: number;
  voipMonthly: number;
  webHostingMonthly: number;
  emailMonthly: number;
}

// ============================================================================
// Wizard Types
// ============================================================================

export interface WizardStep {
  id: string;
  title: string;
  description: string;
  isComplete: boolean;
  isActive: boolean;
}

export interface StepValidation {
  isValid: boolean;
  errors: string[];
}

// ============================================================================
// Legacy Types (for backward compatibility)
// ============================================================================

export type ServiceTier = 'essential' | 'professional' | 'enterprise';

export interface DeviceCount {
  workstations: number;
  laptops: number;
  servers: number;
  networkDevices: number;
  mobileDevices: number;
}

export interface ServiceSelection {
  tier: ServiceTier;
  addOns: string[];
}

export interface PricingTier {
  id: ServiceTier;
  name: string;
  description: string;
  basePrice: number;
  perDevicePrice: number;
  features: string[];
  recommended?: boolean;
}

export interface AddOn {
  id: string;
  name: string;
  description: string;
  price: number;
  priceType: 'flat' | 'per-device' | 'per-user';
}
