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;

@Data
public class FoodPersonalMealOrderCreateDTO {

    private String memberId;

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

    @NotBlank(message = "餐别不能为空")
    private String mealType;

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

    @Valid
    @NotEmpty(message = "订餐明细不能为空")
    private List<Item> items;

    private String addressId;

    private String deliveryType;

    private String remark;

    private String subject;

    private String description;

    @Data
    public static class Item {

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

        private String specId;

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