package com.liquidnet.service.kylin.dto.param;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * 创建拼团活动请求参数（不含 activityId）。
 */
@Data
@ApiModel(value = "KylinGroupBuyActivityCreateParam", description = "创建拼团活动")
public class KylinGroupBuyActivityCreateParam implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "活动名称", required = true)
    @NotNull(message = "活动名称不能为空")
    private String name;

    @ApiModelProperty(value = "关联演出ID", required = true)
    @NotNull(message = "关联演出ID不能为空")
    private String performanceId;

    @ApiModelProperty(value = "成团人数", required = true)
    @NotNull(message = "成团人数不能为空")
    private Integer minGroupSize;

    @ApiModelProperty(value = "每人限购", required = true)
    @NotNull(message = "每人限购不能为空")
    private Integer maxBuyPerUser;

    @ApiModelProperty(value = "活动开始时间，格式 yyyy-MM-dd HH:mm:ss", required = true, example = "2026-07-17 00:00:00")
    @NotNull(message = "活动开始时间不能为空")
    private String startTime;

    @ApiModelProperty(value = "活动结束时间，格式 yyyy-MM-dd HH:mm:ss", required = true, example = "2026-12-31 23:59:59")
    @NotNull(message = "活动结束时间不能为空")
    private String endTime;

    @ApiModelProperty(value = "启动方式 1立即 2手动 3定时", required = true)
    @NotNull(message = "启动方式不能为空")
    private Integer launchType;

    @ApiModelProperty(value = "定时启动时间，格式 yyyy-MM-dd HH:mm:ss（launchType=3 时必填）", example = "2026-07-18 10:00:00")
    private String scheduledTime;

    @ApiModelProperty(value = "活动说明")
    private String description;

    @Valid
    @NotEmpty(message = "票种优惠不能为空")
    @ApiModelProperty(value = "票种优惠配置", required = true)
    private List<DiscountParam> discounts;

    @Data
    @ApiModel(value = "KylinGroupBuyActivityDiscountParam", description = "拼团票种优惠")
    public static class DiscountParam implements Serializable {
        private static final long serialVersionUID = 1L;

        @ApiModelProperty(value = "场次ID", required = true)
        @NotNull(message = "场次ID不能为空")
        private String timeId;

        @ApiModelProperty(value = "票种ID", required = true)
        @NotNull(message = "票种ID不能为空")
        private String ticketId;

        @ApiModelProperty(value = "优惠类型 1固定价格 2折扣 3满减", required = true)
        @NotNull(message = "优惠类型不能为空")
        private Integer discountType;

        @ApiModelProperty(value = "优惠值", required = true)
        @NotNull(message = "优惠值不能为空")
        private BigDecimal discountValue;
    }
}
