export interface ShiftValidationResult {
  valid: boolean;
  errors: ValidationError[];
  warnings: ValidationWarning[];
  costImpact: CostImpact;
  conflictDetails: ConflictDetail[];
}

export interface ValidationError {
  code: string;
  message: string;
  field?: string;
  resourceId?: string;
  allocationId?: string;
}

export interface ValidationWarning {
  code: string;
  message: string;
  field?: string;
  resourceId?: string;
}

export interface CostImpact {
  currentTotalCents: number;
  newTotalCents: number;
  deltaCents: number;
  budgetCents: number;
  budgetUtilizationBefore: number;
  budgetUtilizationAfter: number;
  wouldExceedBudget: boolean;
}

export interface ConflictDetail {
  resourceId: string;
  resourceName: string;
  conflictType: "availability" | "overlap" | "capacity";
  days: string[];
  message: string;
}

export interface AbsenceDay {
  date: Date;
  type: import("./calculation-rules.js").AbsenceTrigger;
  isHalfDay?: boolean;
}

export interface AllocationCalculationInput {
  lcrCents: number;
  hoursPerDay: number;
  startDate: Date;
  endDate: Date;
  availability: import("./resource.js").WeekdayAvailability;
  /** When false (default), Saturday hours are ignored even if resource has availability.saturday set */
  includeSaturday?: boolean;
  /** Recurrence pattern — when set, only matching days in the range accumulate hours */
  recurrence?: import("./allocation.js").RecurrencePattern;
  /** APPROVED vacation dates — these days are blocked regardless of other settings */
  vacationDates?: Date[];
  /** Typed absence days (vacation, sick, public holiday) — used by the rules engine */
  absenceDays?: AbsenceDay[];
  /** Calculation rules — when provided, absence days are evaluated against these rules */
  calculationRules?: import("./calculation-rules.js").CalculationRule[];
  /** Order type of the project — used for rule matching */
  orderType?: string;
  /** Project ID — used for rule matching */
  projectId?: string;
}

export interface AllocationCalculationResult {
  workingDays: number;
  totalHours: number;
  totalCostCents: number;
  dailyCostCents: number;
  dailyBreakdown: DailyBreakdown[];
  /** Total hours counting toward chargeability (rules-adjusted) */
  totalChargeableHours?: number;
  /** Cost after rule adjustments (e.g. sick days zeroed out) */
  totalProjectCostCents?: number;
}

export interface DailyBreakdown {
  date: Date;
  isWorkday: boolean;
  hours: number;
  costCents: number;
  /** Absence type for this day (if any rule matched) */
  absenceType?: import("./calculation-rules.js").AbsenceTrigger;
  /** Hours that count toward chargeability (may differ from hours when rules apply) */
  chargeableHours?: number;
}

export interface BudgetStatus {
  budgetCents: number;
  allocatedCents: number;
  confirmedCents: number;
  proposedCents: number;
  remainingCents: number;
  utilizationPercent: number;
  winProbabilityWeightedCents: number;
  warnings: BudgetWarning[];
}

export interface BudgetWarning {
  level: "info" | "warning" | "critical";
  code: string;
  message: string;
  thresholdPercent: number;
  currentPercent: number;
}
