package at.fos.ermodel.gui;

public class C3
        implements Comparable<C3> {
    private final String columnName;
    protected String dataGenerationType;
    protected String par1;
    protected String par2;
    private String datatype;
    private boolean isKey;
    private boolean isNullable;
    private boolean isUnique;
    private boolean isAutoincrement;
    private long autoincrementStartAt;
    private T2 referencesTo;
    private long referstoGraphicalElement;

    public C3(String columnName, String datatype, boolean isKey, boolean isNullable, boolean isUnique, boolean isAutoincrement, long autoincrementStartAt, T2 referencesTo, long referstoGraphicalElement, String dataGenerationType, String par1, String par2) {
        this.columnName = columnName;
        this.datatype = datatype;
        this.isKey = isKey;
        this.isNullable = isNullable;
        this.isUnique = isUnique;
        this.isAutoincrement = isAutoincrement;
        this.autoincrementStartAt = autoincrementStartAt;
        this.referencesTo = referencesTo;
        this.referstoGraphicalElement = referstoGraphicalElement;
        this.dataGenerationType = dataGenerationType;
        this.par1 = par1;
        this.par2 = par2;
    }


    public C3(String columnName) {
        this.columnName = columnName;
    }


    public String getColumnName() {
        return this.columnName;
    }


    public String getDatatype() {
        return this.datatype;
    }


    public boolean isKey() {
        return this.isKey;
    }


    public boolean isNullable() {
        return this.isNullable;
    }


    public boolean isUnique() {
        return this.isUnique;
    }


    public boolean isAutoincrement() {
        return this.isAutoincrement;
    }


    public long getAutoincrementStartAt() {
        return this.autoincrementStartAt;
    }


    public T2 getReferencesTo() {
        return this.referencesTo;
    }


    public int hashCode() {
        int result = 1;
        result = 31 * result + ((this.columnName == null) ? 0 : this.columnName.hashCode());
        return result;
    }


    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        C3 other = (C3) obj;
        if (this.columnName == null) {
            return other.columnName == null;
        } else return this.columnName.equals(other.columnName);
    }


    public String toString() {
        return "RM_Column [columnName=" + this.columnName + ", datatype=" + this.datatype + ", isKey=" + this.isKey + ", isNullable=" +
                this.isNullable + ", isUnique=" + this.isUnique + ", isAutoincrement=" + this.isAutoincrement + ", referencesTo=" +
                this.referencesTo + ", referstoGraphicalElement=" + this.referstoGraphicalElement + ", dataGenerationType=" +
                this.dataGenerationType + ", par1=" + this.par1 + ", par2=" + this.par2 + "]";
    }


    public int compareTo(C3 o) {
        if (this.isKey && !o.isKey) return -1;
        if (!this.isKey && o.isKey) return 1;
        return 0;
    }


    public long getReferstoGraphicalElement() {
        return this.referstoGraphicalElement;
    }
}


