package com.yc.ship.module.trade.controller.app.otc.vo;

import com.yc.ship.framework.common.validation.InStringEnum;
import com.yc.ship.framework.common.validation.IntEnum;
import com.yc.ship.module.product.enums.SpecTypeEnum;
import com.yc.ship.module.trade.api.dto.TradeOrderCreateReqDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Schema(description = "旅行社app交易订单创建 Request VO")
@Data
public class AppOtcTradeOrderCreateReqVO implements Serializable {


    @Schema(description = "出行日期", example = "2025-06-01")
    private Date travelDate;

    @Schema(description = "订单项列表", example = "")
    @NotEmpty(message = "订单项列表不能为空")
    private List<TradeOrderCreateReqDTO.OrderItem> itemlList;


    @Schema(description = "订单联系信息", example = "")
    @NotNull(message = "联系人信息不能为空")
    private TradeOrderCreateReqDTO.OrderUser orderUser;

    @Schema(description = "订单属性", example = "")
    private TradeOrderCreateReqDTO.OrderProperty orderProperty;

    @Schema(description = "订单备注", example = "xx游客岁数较大")
    private String remark;

    @Schema(description = "订单项")
    @Data
    @Valid
    public static class OrderItem{

        @Schema(description = "产品ID", example = "")
        @NotBlank(message = "产品ID不能为空")
        private String productId;

        @Schema(description = "产品类型 0 自建产品 1平台产品", example = "")
        @NotNull(message = "产品类型不能为空")
        private Integer productType;

        @Schema(description = "出行日期", example = "2025-06-01")
        private Date useDate;

        @Schema(description = "订单明细列表", example = "")
        @NotEmpty(message = "订单明细列表不能为空")
        private List<OrderDetail> detailList;

    }

    @Schema(description = "订单明细")
    @Data
    @Valid
    public static class OrderDetail{

        @Schema(description = "产品ID", example = "")
        @NotBlank(message = "产品ID不能为空")
        private String productId;

        @Schema(description = "产品类型 0 自建产品 1平台产品", example = "")
        @NotNull(message = "产品类型不能为空")
        private Integer productType;

        @Schema(description = "规格类型", example = "full")
        @InStringEnum(value = SpecTypeEnum.class,message = "规格类型不正确")
        @NotBlank(message = "规格类型不能为空")
        private String specType;

        @Schema(description = "购买数量", example = "10")
        @NotNull(message = "购买数量不能为空")
        private Integer count;

        @Schema(description = "游客列表", example = "")
        private List<TradeOrderCreateReqDTO.Visitor> visitorList;

        @Schema(description = "游客列表（一票多人）", example = "")
        private List<TradeOrderCreateReqDTO.MultilVisitor> multilVisitorList;
    }
}
