package cn.axzo.workflow.common.model.request.bpmn.task;

import cn.axzo.workflow.common.enums.AttachmentTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.dromara.easyes.annotation.IndexField;
import org.dromara.easyes.annotation.rely.FieldType;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 附件模型
 *
 * @author wangli
 * @since 2023/11/22 23:17
 */
@ApiModel("附件模型")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class AttachmentDTO implements Serializable {

    private static final long serialVersionUID = 6954179791395744269L;
    /**
     * 附件 ID
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String id;

    /**
     * 附件类型, 图片还是附件
     */
    @ApiModelProperty(value = "附件类型")
    @NotNull(message = "附件类型不能为空")
    @IndexField(fieldType = FieldType.KEYWORD)
    private AttachmentTypeEnum type;

    /**
     * 文件名称,需携带附件的后缀
     */
    @ApiModelProperty(value = "文件名称不能为空")
    @NotBlank(message = "文件名称不能为空")
    @IndexField(fieldType = FieldType.KEYWORD)
    private String name;

    /**
     * 文件描述
     */
    @ApiModelProperty(value = "文件描述")
    @IndexField(exist = false)
    private String description;

    /**
     * 文件地址
     */
    @ApiModelProperty(value = "附件地址")
    @NotBlank(message = "附件地址不能为空")
    @IndexField(fieldType = FieldType.KEYWORD)
    private String url;

    /**
     * 文件 OSS 的 fileKey
     */
    @ApiModelProperty(value = "附件 oss 的 fileKey")
    private String fileKey;

}
