import {
  Sunrise,
  Sun,
  Moon,
  Pencil,
  Send,
  ChefHat,
  Check,
  type LucideIcon,
} from "lucide-react";

export type MealType = "breakfast" | "lunch" | "dinner";
export type OrderStatus = "draft" | "submitted" | "preparing" | "completed";

export interface MealTypeConfig {
  value: MealType;
  label: string;
  sublabel?: string;
  icon: LucideIcon;
  color: string;
}

export interface StatusConfig {
  value: OrderStatus;
  label: string;
  icon: LucideIcon;
  bgColor: string;
  textColor: string;
  borderColor: string;
  dotColor: string;
  description: string;
}

export const MEAL_TYPES: MealTypeConfig[] = [
  {
    value: "breakfast",
    label: "Breakfast",
    sublabel: "Frühstück",
    icon: Sunrise,
    color: "text-orange-500",
  },
  {
    value: "lunch",
    label: "Lunch",
    sublabel: "Mittagessen",
    icon: Sun,
    color: "text-yellow-500",
  },
  {
    value: "dinner",
    label: "Dinner",
    sublabel: "Abendessen",
    icon: Moon,
    color: "text-indigo-500",
  },
];

export const ORDER_STATUSES: StatusConfig[] = [
  {
    value: "draft",
    label: "Draft",
    icon: Pencil,
    bgColor: "bg-gray-50",
    textColor: "text-gray-700",
    borderColor: "border-gray-200",
    dotColor: "bg-gray-400",
    description: "In progress",
  },
  {
    value: "submitted",
    label: "Submitted",
    icon: Send,
    bgColor: "bg-blue-50",
    textColor: "text-blue-700",
    borderColor: "border-blue-200",
    dotColor: "bg-blue-500",
    description: "Sent to kitchen",
  },
  {
    value: "preparing",
    label: "Preparing",
    icon: ChefHat,
    bgColor: "bg-yellow-50",
    textColor: "text-yellow-700",
    borderColor: "border-yellow-200",
    dotColor: "bg-yellow-500",
    description: "Being prepared",
  },
  {
    value: "completed",
    label: "Completed",
    icon: Check,
    bgColor: "bg-green-50",
    textColor: "text-green-700",
    borderColor: "border-green-200",
    dotColor: "bg-green-500",
    description: "Finished",
  },
];

export const getMealTypeConfig = (
  type: MealType,
): MealTypeConfig | undefined => {
  return MEAL_TYPES.find((m) => m.value === type);
};

export const getStatusConfig = (
  status: OrderStatus,
): StatusConfig | undefined => {
  return ORDER_STATUSES.find((s) => s.value === status);
};

export const getMealTypeLabel = (type: MealType): string => {
  return getMealTypeConfig(type)?.label ?? type;
};

export const getStatusLabel = (status: OrderStatus): string => {
  return getStatusConfig(status)?.label ?? status;
};
