package com.backendsys.modules.ai.volcengine.entity;

import com.backendsys.config.Mybatis.handler.timezone.LocalDateTimeAdapter;
import com.backendsys.entity.validator.RangeArray;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.gson.annotations.JsonAdapter;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

@TableName("ai_volcengine_video_task")
@Data
public class VolcengineVideoTask {

    public static interface Query{}
    public static interface Generate{}

    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 用户ID
     */
    private Long user_id;

    /**
     * 模型
     */
    @NotBlank(message = "请选择模型", groups = { Generate.class })
    private String model;
    /**
     * 图片地址
     */
    @NotBlank(message = "请上传图片", groups = { Generate.class })
    private String img_url;

    /**
     * 分辨率 480p 720p 1080p
     */
    @NotBlank(message = "请选择分辨率", groups = { Generate.class })
    private String resolution;

    /**
     * 时长 秒
     */
    @NotNull(message = "请选择时长", groups = { Generate.class })
    @RangeArray(message="时长取值有误，范围应是(5, 10)", value = { "5", "10" })
    private Integer duration;

    /**
     * 文本说明
     */
    @Size(max = 500, message = "提示词长度不能超过 {max} 字符", groups = { Generate.class })
    private String text;

    /**
     * 是否固定镜头 1-是 -1-否
     */
    private Integer camerafixed;

    /**
     * 生成数量
     */
    @NotNull(message="生成数量不能为空")
    @RangeArray(message="生成数量取值有误，范围应是(1, 2, 3, 4)", value = { "1", "2", "3", "4" }, groups = { Generate.class })
    private Integer quantity;

    @JsonAdapter(LocalDateTimeAdapter.class)
    private LocalDateTime create_time;
    @JsonAdapter(LocalDateTimeAdapter.class)
    private LocalDateTime update_time;

    @TableField(exist = false)
    private List<VolcengineVideoTaskDetail> detail_list;

    /**
     * 是否收藏 1-是 -1-否
     */
    @TableField(exist = false)
    private Integer is_collect;

    /**
     * 用户id参数，用于分页查询
     */
    @TableField(exist = false)
    @JsonIgnore
    private Long param_user_id;

}
