package com.cf.imes.module.system.controller.admin.funds.advertisement.vo;

import com.cf.imes.framework.common.validation.InScope;
import com.cf.imes.framework.common.validation.NumberValid;
import com.cf.imes.module.system.enums.advertisement.AdvertisementPositionEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.time.LocalDate;
import java.util.List;

import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;

@Schema(description = "管理后台 - 广告新增/修改 Request VO")
@Data
public class AdvertisementSaveReqVO {

    @Schema(description = "广告id")
    private Long id;


    @Schema(description = "广告名称")
    @NotBlank(message = "{ad.name.notBlank}")
    @Size(max = 32, message = "{ad.name.size}")
    private String adName;


    @Schema(description = "广告位置,字典键值", example = "[1,2]")
    @NotEmpty(message = "{ad.position.notEmpty}")
    @InScope(value = AdvertisementPositionEnum.class, desc = "inScope.adPosition")
    private List<Integer> adPosition;


    @Schema(description = "广告图片文件路径")
    @NotBlank(message = "{ad.adImagePath.notBlank}")
    @Size(max = 255, message = "{ad.adImagePath.size}")
    private String adImagePath;


    @Schema(description = "投放开始时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
    @NotNull(message = "{ad.startTime.notNull}")
    private LocalDate startTime;


    @Schema(description = "投放结束时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
    @NotNull(message = "{ad.endTime.notNull}")
    private LocalDate endTime;


    @Schema(description = "跳转路径")
    @Size(max = 255, message = "{ad.adRedirectUrl.size}")
    private String adRedirectUrl;


    @Schema(description = "广告顺序")
    @NumberValid(name = "ad.sort.field")
    private Integer sort;
}
