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

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.time.LocalDateTime;
import java.util.List;

@Data
public class KylinGroupBuyActivityParam implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "活动ID，编辑时必传")
    private String activityId;

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

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

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

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

    @ApiModelProperty(value = "活动开始时间")
    @NotNull(message = "活动开始时间不能为空")
    private LocalDateTime startTime;

    @ApiModelProperty(value = "活动结束时间")
    @NotNull(message = "活动结束时间不能为空")
    private LocalDateTime endTime;

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

    @ApiModelProperty(value = "定时启动时间")
    private LocalDateTime scheduledTime;

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

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

    @Data
    public static class DiscountParam implements Serializable {
        private static final long serialVersionUID = 1L;

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

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

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

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