package com.ruoyi.info.ad.domain.bo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.filepathsplicing.FilePathValue;
import com.ruoyi.info.quicklink.enums.JumpType;
import com.ruoyi.info.quicklink.enums.ResourceModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 广告业务对象 tb_ad
 *
 * @author lubo
 * @date 2023-12-21
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel("广告业务对象")
public class AdBo extends BaseEntity {

    /**
     * 广告id
     */
    @ApiModelProperty(value = "广告id", required = true)
    @NotNull(message = "广告id不能为空", groups = { EditGroup.class })
    private Long adId;

    /**
     * 广告位置
     */
    @ApiModelProperty(value = "广告位置", required = true)
    @NotBlank(message = "广告位置不能为空", groups = {AddGroup.class, EditGroup.class})
    @Length(min = 1,max = 50, message = "广告位置不能超过50个字", groups = {AddGroup.class, EditGroup.class})
    private String locationCode;

    /**
     * 广告名称
     */
    @ApiModelProperty(value = "广告名称", required = true)
    @NotBlank(message = "广告名称不能为空", groups = { AddGroup.class, EditGroup.class })
    @Length(message = "广告位名称多最多50个字",min = 1,max = 50,groups = { AddGroup.class, EditGroup.class })
    private String adName;

    /**
     * 广告图片
     */
    @FilePathValue
    @ApiModelProperty(value = "广告图片", required = true)
    @NotBlank(message = "广告图片不能为空", groups = { AddGroup.class, EditGroup.class })
    private String image;

    /**
     * 跳转类型（内部页面0、外部链接1，内部资源模型2）
     */
    @ApiModelProperty(value = "跳转类型（内部页面0、外部链接1，内部资源模型2）", required = true)
    @NotNull(message = "跳转类型（内部页面0、外部链接1，内部资源模型2）不能为空", groups = { AddGroup.class, EditGroup.class })
    private JumpType jumpType;

    /**
     * 内部页面标识
     */
    @ApiModelProperty(value = "内部页面标识", required = true)
    private String innerPageCode;

    /**
     * 外部链接地址
     */
    @ApiModelProperty(value = "外部链接地址", required = true)
    private String outsideAddress;

    /**
     * 内部资源具体模型（无0，公告1，积分商品2，景区3,协议4）
     */
    @ApiModelProperty(value = "内部资源具体模型（无0，公告1，积分商品2，景区3）", required = true)
    private ResourceModel resourceModel;

    /**
     * 内部资源id
     */
    @ApiModelProperty(value = "内部资源id", required = true)
    private Long resourceModelId;

    /**
     * 内部资源标题
     */
    @ApiModelProperty("内部资源标题")
    private String resourceModelTitle;

    /**
     * 上架状态（启用/隐藏）
     */
    @ApiModelProperty(value = "上架状态（启用/隐藏）", required = true)
    @NotNull(message = "上架状态（启用/隐藏）不能为空", groups = { AddGroup.class, EditGroup.class })
    private Boolean status;

    /**
     * 序号
     */
    @ApiModelProperty(value = "序号", required = true)
    @NotNull(message = "序号不能为空", groups = { AddGroup.class, EditGroup.class })
    @Range(message = "排序值范围0-9999", min = 0,max = 9999,groups = { AddGroup.class, EditGroup.class })
    private Integer orderIndex;

    /**
     * 广告备注
     */
    @ApiModelProperty(value = "广告备注")
    private String remark;

    /** 查询用 **/
    /**
     * 创建时间开始
     */
    @ApiModelProperty(value = "创建时间开始")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTimeStart;

    /**
     * 创建时间结束
     */
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间结束")
    private Date createTimeEnd;

}
