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

import com.eshore.gringotts.core.Constants;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = Constants.TABLE_PREFIX + "resource_type_database")
public class DatabaseResourceType extends ResourceType {
    @Column(nullable = false)
    private String jdbc;
    private String username;
    private String password;
    @Column(nullable = false)
    @Enumerated(EnumType.STRING)
    private DatabaseType databaseType;

    @Override
    public Type getResourceType() {
        return Type.DATABASE;
    }

    public enum DatabaseType {
        MYSQL,
        POSTGRESQL,
        ORACLE,
    }
}
