package com.eshore.gringotts.web.domain.entity.type;

import com.eshore.gringotts.core.Constants;
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

/**
 * 资源类型
 *
 * @author lanyuanxiaoyao
 * @date 2024-11-20
 */
@Getter
@Setter
@ToString
@Entity
@Table(name = Constants.TABLE_PREFIX + "resource_type")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_type" + " set deleted = true where id = ?")
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
public abstract class ResourceType extends LogicDeleteIdOnlyEntity {
    public abstract Type getResourceType();

    public enum Type {
        API,
        DATABASE,
        FILE,
        FTP,
        HDFS,
    }
}
