import type { OrderStatus, AppointmentStatus } from './types';

export const STATUS_LABELS: Record<OrderStatus, string> = {
  draft: 'Draft',
  in_progress: 'In Progress',
  waiting_on_parts: 'Waiting on Parts',
  ready: 'Ready',
  overdue: 'Overdue',
  paid: 'Paid',
  closed: 'Closed',
};

export const STATUS_TRANSITIONS: Record<OrderStatus, OrderStatus[]> = {
  draft: ['in_progress', 'closed'],
  in_progress: ['waiting_on_parts', 'ready', 'overdue', 'closed'],
  waiting_on_parts: ['in_progress', 'ready', 'overdue', 'closed'],
  ready: ['paid', 'closed'],
  overdue: ['in_progress', 'waiting_on_parts', 'ready', 'closed'],
  paid: [],
  closed: [],
};

export const CATEGORIES = [
  'Brakes',
  'Electrical',
  'Engine',
  'Exhaust',
  'Exterior',
  'Filters',
  'Fluids',
  'Ignition',
  'Suspension',
  'Tires',
  'Transmission',
  'Other',
] as const;

export const PAYMENT_METHODS = [
  { value: 'card', label: 'Card' },
  { value: 'cash', label: 'Cash' },
  { value: 'invoice', label: 'Invoice (Net 30)' },
  { value: 'bank_transfer', label: 'Bank transfer' },
] as const;

export const LINE_ITEM_KIND_LABELS = {
  part: 'Part',
  labor: 'Labor',
  custom: 'Custom',
} as const;

export const ROLE_LABELS = {
  admin: 'Admin',
  staff: 'Staff',
  technician: 'Technician',
  accounts: 'Accounts',
} as const;

export const TIER_LABELS = {
  none: 'Standard',
  bronze: 'Bronze',
  silver: 'Silver',
  gold: 'Gold',
} as const;

export const APPOINTMENT_STATUS_LABELS: Record<AppointmentStatus, string> = {
  pending: 'Pending',
  confirmed: 'Confirmed',
  completed: 'Completed',
  cancelled: 'Cancelled',
  converted: 'Converted to Order',
};

export const APPOINTMENT_TRANSITIONS: Record<AppointmentStatus, AppointmentStatus[]> = {
  pending: ['confirmed', 'cancelled'],
  confirmed: ['completed', 'cancelled', 'converted'],
  completed: [],
  cancelled: [],
  converted: [],
};

export const APPROVAL_STATUS_LABELS = {
  none: 'Not requested',
  pending: 'Awaiting customer',
  approved: 'Approved by customer',
  declined: 'Declined by customer',
} as const;

// Booking grid (v1: fixed; a future Shop setting)
export const BOOKING = {
  // 0 = Sunday; shop is open Mon–Sat
  openDays: [1, 2, 3, 4, 5, 6],
  // Hourly slots with a lunch gap, shop-local times
  slots: ['09:00', '10:00', '11:00', '13:00', '14:00', '15:00', '16:00'],
} as const;
