package de.ivu.elect.business.system.entity;

import java.io.Serializable;
import java.util.List;

import javax.annotation.Nullable;

public class DbInformation implements Serializable {

  private boolean schemaVorhanden;
  @Nullable
  private final Long version;

  private final List<DbScript> scripts;
  private final String productName;
  private final DbType dbType;

  public DbInformation(boolean schemaVorhanden, @Nullable Long version, List<DbScript> scripts, String productName) {
    this.schemaVorhanden = schemaVorhanden;
    this.version = version;
    this.scripts = scripts;
    this.productName = productName;
    this.dbType = DbType.fromProductName(productName);
  }

  public List<DbScript> getScripts() {
    return scripts;
  }

  @Nullable
  public Long getVersion() {
    return version;
  }

  public String getProductName() {
    return productName;
  }

  public boolean isSchemaVorhanden() {
    return schemaVorhanden;
  }

  public DbType getDbType() {
    return dbType;
  }

  @Override
  public String toString() {
    return "DbInformation{" +
        "schemaVorhanden=" + schemaVorhanden +
        ", version=" + version +
        ", scripts=" + scripts +
        ", productName='" + productName + '\'' +
        ", dbType=" + dbType +
        '}';
  }
}
