package com.jeesharp.business.modules.food.dto;

import jakarta.validation.Valid;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.time.LocalDate;
import java.util.List;

/**
 * 企业团餐试算 DTO。
 */
@Data
public class FoodCompanyMealTrialDTO {

    /**
     * 会员ID，小程序登录场景由网关写入
     */
    private String memberId;

    /**
     * 企业ID
     */
    @NotBlank(message = "企业ID不能为空")
    private String companyId;

    /**
     * 菜单ID
     */
    @NotBlank(message = "菜单ID不能为空")
    private String menuId;

    /**
     * 餐别：breakfast/lunch/dinner/snack
     */
    @NotBlank(message = "餐别不能为空")
    private String mealType;

    /**
     * 订餐日期/用餐日期
     */
    @NotNull(message = "订餐日期不能为空")
    private LocalDate mealDate;

    /**
     * 试算明细
     */
    @Valid
    @NotEmpty(message = "试算明细不能为空")
    private List<Item> items;

    @Data
    public static class Item {

        /**
         * 菜单明细ID
         */
        @NotBlank(message = "菜单明细ID不能为空")
        private String menuItemId;

        /**
         * 规格ID
         */
        private String specId;

        /**
         * 数量
         */
        @NotNull(message = "数量不能为空")
        @Min(value = 1, message = "数量必须大于0")
        private Integer quantity;
    }
}
