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

import com.cf.imes.framework.common.validation.NumberValid;
import com.cf.imes.module.system.validation.advertisement.AdvertisementStatus;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.multipart.MultipartFile;

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

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 = "广告名称不能为空")
    @Size(max = 32, message = "广告名称长度不能超过 32 个字符")
    private String adName;


    @Schema(description = "软件标识")
    private String softwareId;


    @Schema(description = "广告位置,字典键值", example = "[1,2]")
    @NotNull(message = "广告位置不能为空")
    private Integer[] adPosition;


    @Schema(description = "广告图片文件")
    @NotBlank(message = "广告图片文件不能为空")
    private MultipartFile adImageFile;


    @Schema(description = "投放开始时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
    @NotNull(message = "投放开始时间不能为空")
    private LocalDate startTime;


    @Schema(description = "投放结束时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
    @NotNull(message = "投放结束时间不能为空")
    private LocalDate endTime;


    @Schema(description = "跳转路径")
    @Size(max = 255, message = "链接长度不能超过 255 个字符")
    private String adRedirectUrl;


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


    @Schema(description = "广告状态", example = "0全部 1未发布 2已发布 3已结束")
    @AdvertisementStatus
    private Integer status;


}
