export interface OptionItem {
  key: string
  label: string
}

export interface OptionSection {
  title: string
  columns: 1 | 2 | 3
  options: OptionItem[]
}

export interface BreakfastOptions {
  accordingToPlan: boolean
  bread: {
    breadRoll: boolean
    wholeGrainRoll: boolean
    greyBread: boolean
    wholeGrainBread: boolean
    whiteBread: boolean
    crispbread: boolean
  }
  porridge: boolean
  preparation: { sliced: boolean; spread: boolean }
  spreads: {
    butter: boolean
    margarine: boolean
    jam: boolean
    diabeticJam: boolean
    honey: boolean
    cheese: boolean
    quark: boolean
    sausage: boolean
  }
  beverages: { coffee: boolean; tea: boolean; hotMilk: boolean; coldMilk: boolean }
  additions: { sugar: boolean; sweetener: boolean; coffeeCreamer: boolean }
}

export interface LunchOptions {
  portionSize: 'small' | 'large' | 'vegetarian'
  soup: boolean
  dessert: boolean
  specialPreparations: {
    pureedFood: boolean
    pureedMeat: boolean
    slicedMeat: boolean
    mashedPotatoes: boolean
  }
  restrictions: { noFish: boolean; fingerFood: boolean; onlySweet: boolean }
}

export interface DinnerOptions {
  accordingToPlan: boolean
  bread: { greyBread: boolean; wholeGrainBread: boolean; whiteBread: boolean; crispbread: boolean }
  preparation: { spread: boolean; sliced: boolean }
  spreads: { butter: boolean; margarine: boolean }
  soup: boolean
  porridge: boolean
  noFish: boolean
  beverages: { tea: boolean; cocoa: boolean; hotMilk: boolean; coldMilk: boolean }
  additions: { sugar: boolean; sweetener: boolean }
}

export const DEFAULT_BREAKFAST: BreakfastOptions = {
  accordingToPlan: false,
  bread: {
    breadRoll: false,
    wholeGrainRoll: false,
    greyBread: false,
    wholeGrainBread: false,
    whiteBread: false,
    crispbread: false,
  },
  porridge: false,
  preparation: { sliced: false, spread: false },
  spreads: {
    butter: false,
    margarine: false,
    jam: false,
    diabeticJam: false,
    honey: false,
    cheese: false,
    quark: false,
    sausage: false,
  },
  beverages: { coffee: false, tea: false, hotMilk: false, coldMilk: false },
  additions: { sugar: false, sweetener: false, coffeeCreamer: false },
}

export const DEFAULT_LUNCH: LunchOptions = {
  portionSize: 'large',
  soup: false,
  dessert: true,
  specialPreparations: {
    pureedFood: false,
    pureedMeat: false,
    slicedMeat: false,
    mashedPotatoes: false,
  },
  restrictions: { noFish: false, fingerFood: false, onlySweet: false },
}

export const DEFAULT_DINNER: DinnerOptions = {
  accordingToPlan: false,
  bread: { greyBread: false, wholeGrainBread: false, whiteBread: false, crispbread: false },
  preparation: { spread: false, sliced: false },
  spreads: { butter: false, margarine: false },
  soup: false,
  porridge: false,
  noFish: false,
  beverages: { tea: false, cocoa: false, hotMilk: false, coldMilk: false },
  additions: { sugar: false, sweetener: false },
}

export const BREAKFAST_CONFIG: Record<string, OptionSection> = {
  bread: {
    title: 'Bread (Brot)',
    columns: 2,
    options: [
      { key: 'breadRoll', label: 'Bread Roll' },
      { key: 'wholeGrainRoll', label: 'Whole Grain Roll' },
      { key: 'greyBread', label: 'Grey Bread' },
      { key: 'wholeGrainBread', label: 'Whole Grain' },
      { key: 'whiteBread', label: 'White Bread' },
      { key: 'crispbread', label: 'Crispbread' },
    ],
  },
  preparation: {
    title: 'Preparation',
    columns: 3,
    options: [
      { key: 'porridge', label: 'Porridge' },
      { key: 'sliced', label: 'Sliced' },
      { key: 'spread', label: 'Spread' },
    ],
  },
  spreads: {
    title: 'Spreads',
    columns: 2,
    options: [
      { key: 'butter', label: 'Butter' },
      { key: 'margarine', label: 'Margarine' },
      { key: 'jam', label: 'Jam' },
      { key: 'diabeticJam', label: 'Diabetic Jam' },
      { key: 'honey', label: 'Honey' },
      { key: 'cheese', label: 'Cheese' },
      { key: 'quark', label: 'Quark' },
      { key: 'sausage', label: 'Sausage' },
    ],
  },
  beverages: {
    title: 'Beverages',
    columns: 2,
    options: [
      { key: 'coffee', label: 'Coffee' },
      { key: 'tea', label: 'Tea' },
      { key: 'hotMilk', label: 'Hot Milk' },
      { key: 'coldMilk', label: 'Cold Milk' },
    ],
  },
  additions: {
    title: 'Additions',
    columns: 3,
    options: [
      { key: 'sugar', label: 'Sugar' },
      { key: 'sweetener', label: 'Sweetener' },
      { key: 'coffeeCreamer', label: 'Creamer' },
    ],
  },
}

export const LUNCH_CONFIG = {
  portionSizes: [
    { value: 'small', label: 'Small' },
    { value: 'large', label: 'Large' },
    { value: 'vegetarian', label: 'Vegetarian' },
  ] as const,
  mealOptions: {
    title: 'Meal Options',
    columns: 2 as const,
    options: [
      { key: 'soup', label: 'Soup' },
      { key: 'dessert', label: 'Dessert' },
    ],
  },
  specialPreparations: {
    title: 'Special Preparations',
    columns: 2 as const,
    options: [
      { key: 'pureedFood', label: 'Pureed Food' },
      { key: 'pureedMeat', label: 'Pureed Meat' },
      { key: 'slicedMeat', label: 'Sliced Meat' },
      { key: 'mashedPotatoes', label: 'Mashed Potatoes' },
    ],
  },
  restrictions: {
    title: 'Restrictions',
    columns: 3 as const,
    options: [
      { key: 'noFish', label: 'No Fish' },
      { key: 'fingerFood', label: 'Finger Food' },
      { key: 'onlySweet', label: 'Only Sweet' },
    ],
  },
}

export const DINNER_CONFIG: Record<string, OptionSection> = {
  bread: {
    title: 'Bread',
    columns: 2,
    options: [
      { key: 'greyBread', label: 'Grey Bread' },
      { key: 'wholeGrainBread', label: 'Whole Grain' },
      { key: 'whiteBread', label: 'White Bread' },
      { key: 'crispbread', label: 'Crispbread' },
    ],
  },
  preparation: {
    title: 'Preparation',
    columns: 2,
    options: [
      { key: 'spread', label: 'Spread' },
      { key: 'sliced', label: 'Sliced' },
    ],
  },
  spreads: {
    title: 'Spreads',
    columns: 2,
    options: [
      { key: 'butter', label: 'Butter' },
      { key: 'margarine', label: 'Margarine' },
    ],
  },
  additionalItems: {
    title: 'Additional Items',
    columns: 3,
    options: [
      { key: 'soup', label: 'Soup' },
      { key: 'porridge', label: 'Porridge' },
      { key: 'noFish', label: 'No Fish' },
    ],
  },
  beverages: {
    title: 'Beverages',
    columns: 2,
    options: [
      { key: 'tea', label: 'Tea' },
      { key: 'cocoa', label: 'Cocoa' },
      { key: 'hotMilk', label: 'Hot Milk' },
      { key: 'coldMilk', label: 'Cold Milk' },
    ],
  },
  additions: {
    title: 'Additions',
    columns: 2,
    options: [
      { key: 'sugar', label: 'Sugar' },
      { key: 'sweetener', label: 'Sweetener' },
    ],
  },
}

export const getGridColsClass = (cols: 1 | 2 | 3): string => {
  switch (cols) {
    case 1:
      return 'grid-cols-1'
    case 2:
      return 'grid-cols-1 sm:grid-cols-2'
    case 3:
      return 'grid-cols-1 sm:grid-cols-3'
  }
}
