package net.northking.cctp.maven.analyse.entity;

import net.northking.cctp.maven.analyse.util.StringUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * Created on 2019/8/22
 *
 * @author xiusong.xie
 * @since 1.0
 */
public class IndexInfoRef
{
  private String tableName;

  private boolean nonUnique;
  private String indexName;
  private short type;
  private short ordinalPosition;
  private String ascOrDesc;
  private long cardinality;
  private long pages;

  private List<ColumnRef> columnRefList = new ArrayList<>();

  public String getTableName()
  {
    return tableName;
  }

  public void setTableName(String tableName)
  {
    this.tableName = tableName;
  }

  public boolean isNonUnique()
  {
    return nonUnique;
  }

  public void setNonUnique(boolean nonUnique)
  {
    this.nonUnique = nonUnique;
  }

  public String getIndexName()
  {
    return indexName;
  }

  public String getCamelIndexName()
  {
    return StringUtil.underlineToCamel(this.indexName);
  }

  public void setIndexName(String indexName)
  {
    this.indexName = indexName;
  }

  public short getType()
  {
    return type;
  }

  public void setType(short type)
  {
    this.type = type;
  }

  public short getOrdinalPosition()
  {
    return ordinalPosition;
  }

  public void setOrdinalPosition(short ordinalPosition)
  {
    this.ordinalPosition = ordinalPosition;
  }

  public String getAscOrDesc()
  {
    return ascOrDesc;
  }

  public void setAscOrDesc(String ascOrDesc)
  {
    this.ascOrDesc = ascOrDesc;
  }

  public long getCardinality()
  {
    return cardinality;
  }

  public void setCardinality(long cardinality)
  {
    this.cardinality = cardinality;
  }

  public long getPages()
  {
    return pages;
  }

  public void setPages(long pages)
  {
    this.pages = pages;
  }

  public List<ColumnRef> getColumnRefList()
  {
    return columnRefList;
  }

  public void appendColumn(ColumnRef columnRef)
  {
    this.columnRefList.add(columnRef);
  }
}
