export interface ServiceSlot {
  start: string
  end: string
}

export interface ServiceAvailability {
  day: string
  enabled: boolean
  slots: ServiceSlot[]
}

export interface CreateCategoryPayload {
  name: string
}

export interface Category {
  _id: string
  name: string
  description?: string
  order?: number
  imageKey?: string
  salonId: string
  createdAt: string
  updatedAt: string
}

export interface CreateServicePayload {
  name: string
  description?: string
  category?: string
  categoryId?: string
  basePrice: number
  surchargePricePercentage?: number
  duration: number
  availability?: ServiceAvailability[]
  surchargeHours: ServiceAvailability[]
  stylistIds?: string[]
  status?: string
}

// Service returned by the API (GET). Extends the payload with database/meta fields.
export interface Service extends CreateServicePayload {
  _id: string
  salonId: string
  // Optional category present on some items in the API response
  category?: string
  weekendPrice?: number
  status?: string
  createdAt: string // ISO timestamp
  updatedAt: string // ISO timestamp
  __v?: number
}

export interface CategoryWithServices {
  category: string
  categoryId: string
  services: Service[]
}

export interface CategorizedServicesResponse {
  data: CategoryWithServices[]
  meta: {
    total: number
    page: number
    limit: number
    totalPages: number
  }
}

// Convenience alias for arrays returned by list endpoints
export type ServicesResponse = Service[]
