package constants

type OrderType string

const (
	OrderTypeDineIn   OrderType = "dine_in"
	OrderTypeTakeout  OrderType = "takeout"
	OrderTypeDelivery OrderType = "delivery"
)

type OrderStatus string

const (
	OrderStatusPending   OrderStatus = "pending"
	OrderStatusPreparing OrderStatus = "preparing"
	OrderStatusReady     OrderStatus = "ready"
	OrderStatusCompleted OrderStatus = "completed"
	OrderStatusCancelled OrderStatus = "cancelled"
	OrderStatusPaid      OrderStatus = "paid"
)

type OrderItemStatus string

const (
	OrderItemStatusPending   OrderItemStatus = "pending"
	OrderItemStatusPreparing OrderItemStatus = "preparing"
	OrderItemStatusReady     OrderItemStatus = "ready"
	OrderItemStatusServed    OrderItemStatus = "served"
	OrderItemStatusCancelled OrderItemStatus = "cancelled"
	OrderItemStatusCompleted OrderItemStatus = "completed"
	OrderItemStatusPaid      OrderItemStatus = "paid"
)

func GetAllOrderTypes() []OrderType {
	return []OrderType{
		OrderTypeDineIn,
		OrderTypeTakeout,
		OrderTypeDelivery,
	}
}

func GetAllOrderStatuses() []OrderStatus {
	return []OrderStatus{
		OrderStatusPending,
		OrderStatusPreparing,
		OrderStatusReady,
		OrderStatusCompleted,
		OrderStatusCancelled,
		OrderStatusPaid,
	}
}

func GetAllOrderItemStatuses() []OrderItemStatus {
	return []OrderItemStatus{
		OrderItemStatusPending,
		OrderItemStatusPreparing,
		OrderItemStatusReady,
		OrderItemStatusServed,
		OrderItemStatusCancelled,
	}
}

func (o OrderType) IsValidOrderType() bool {
	for _, validType := range GetAllOrderTypes() {
		if o == validType {
			return true
		}
	}
	return false
}

func IsValidOrderStatus(status OrderStatus) bool {
	for _, validStatus := range GetAllOrderStatuses() {
		if status == validStatus {
			return true
		}
	}
	return false
}

func IsValidOrderItemStatus(status OrderItemStatus) bool {
	for _, validStatus := range GetAllOrderItemStatuses() {
		if status == validStatus {
			return true
		}
	}
	return false
}
