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

import com.jeesharp.framework.pojo.dto.BaseSaveDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 优惠券模板保存 DTO。
 *
 * @author jeesharp
 * @since 2026-05-07
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "优惠券模板保存")
public class CouponTemplateSaveDTO extends BaseSaveDTO {

    @Schema(description = "优惠券编码；新增时留空，服务端按 CPN_雪花ID 自动生成；编辑时只读回传")
    private String couponCode;

    @NotBlank(message = "优惠券名称不能为空")
    @Schema(description = "优惠券名称", requiredMode = Schema.RequiredMode.REQUIRED)
    private String couponName;

    @NotNull(message = "优惠券类型不能为空")
    @Schema(description = "优惠券类型", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer couponType;

    @Schema(description = "优惠券图片")
    private String couponImage;

    @NotNull(message = "优惠方式不能为空")
    @Schema(description = "优惠方式：1-金额 2-折扣", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer discountType;

    @NotNull(message = "优惠值不能为空")
    @Schema(description = "优惠值", requiredMode = Schema.RequiredMode.REQUIRED)
    private BigDecimal discountValue;

    @Schema(description = "最低消费金额")
    private BigDecimal minConsumeAmount;

    @Schema(description = "最大优惠金额")
    private BigDecimal maxDiscountAmount;

    @NotNull(message = "使用范围不能为空")
    @Schema(description = "使用范围", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer useScope;

    @NotBlank(message = "使用场景不能为空")
    @Schema(description = "使用场景编号", requiredMode = Schema.RequiredMode.REQUIRED)
    private String sceneCode;

    @Schema(description = "范围ID列表 JSON")
    private String scopeIds;

    @Schema(description = "排除范围 JSON")
    private String excludeScopeIds;

    @NotNull(message = "发行总量不能为空")
    @Schema(description = "发行总量，-1 不限", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer totalCount;

    @NotNull(message = "每人限领不能为空")
    @Schema(description = "每人限领", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer perMemberLimit;

    @NotNull(message = "领取方式不能为空")
    @Schema(description = "领取方式", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer getType;

    @Schema(description = "兑换所需积分")
    private Integer exchangePoints;

    @NotNull(message = "有效期类型不能为空")
    @Schema(description = "有效期类型", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer validityType;

    @Schema(description = "固定有效期开始")
    private LocalDateTime validStartDate;

    @Schema(description = "固定有效期结束")
    private LocalDateTime validEndDate;

    @Schema(description = "领取后有效天数")
    private Integer validDays;

    @Schema(description = "可领取开始时间")
    private LocalDateTime getStartDate;

    @Schema(description = "可领取结束时间")
    private LocalDateTime getEndDate;

    @Schema(description = "可用平台 JSON 数组字符串")
    private String usePlatforms;

    @Schema(description = "可用等级 JSON 数组字符串")
    private String memberLevels;

    @Schema(description = "是否可叠加")
    private Integer canOverlay;

    @Schema(description = "模板状态")
    private Integer status;

    @Schema(description = "使用说明")
    private String description;
}
