package io.delphi.qa.auto.awsmfrw.models.db.sql.dsl;

import org.apache.commons.lang3.ArrayUtils;

public class DslSqlFunctions extends AbstractDslSqlQuery implements InterfaceDslSqlQuery {

  public DslSqlFunctions count(String... xCountAliases) {
    queryArray =
        ArrayUtils.addAll(
            queryArray,
            String.format(
                "(count(%s)",
                xCountAliases.length > 0
                    ? String.join(",", xCountAliases)
                    : InterfaceDslSqlQuery.ALL));
    return this;
  }

  public DslSqlFunctions info() {
    queryArray = ArrayUtils.addAll(super.queryArray, "information_schema.tables");
    return this;
  }

  public DslSqlFunctions sum(String xResult) {
    queryArray = ArrayUtils.addAll(super.queryArray, String.format("(sum(%s)", xResult));
    return this;
  }

  public DslSqlFunctions zero() {
    queryArray = ArrayUtils.addAll(super.queryArray, String.format("%s", 0));
    return this;
  }
}
