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

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_format")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_format" + " set deleted = true where id = ?")
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
public abstract class ResourceFormat extends LogicDeleteIdOnlyEntity {
    public abstract Type getFormatType();

    public enum Type {
        NONE,
        LINE,
        JSON,
        JSON_LINE,
        CSV,
    }
}
