package cn.reghao.oss.console.app.model.po;

import cn.reghao.oss.console.app.model.dto.UploadChannelDto;
import cn.reghao.oss.console.util.db.BaseEntity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;

/**
 * @author reghao
 * @date 2024-02-23 15:05:30
 */
@NoArgsConstructor
@Getter
@Setter
@Entity
public class UploadChannel extends BaseEntity {
    private Integer channelId;
    private String name;
    @Column(nullable = false, unique = true)
    private String prefix;
    private Long maxSize;
    private Integer fileType;
    private Boolean seturl;
    private Integer scope;
    private Integer nodeId;
    private Integer createBy;

    public UploadChannel(int channelId, UploadChannelDto uploadChannelDto, int createBy) {
        this.channelId = channelId;
        this.name = uploadChannelDto.getName();
        this.prefix = uploadChannelDto.getChannelPrefix();
        this.maxSize = uploadChannelDto.getMaxSize();
        this.fileType = uploadChannelDto.getFileType();
        this.seturl = false;
        this.scope = uploadChannelDto.getScope();
        this.nodeId = uploadChannelDto.getNodeId();
        this.createBy = createBy;
    }
}
