package de.frajul.endlessroll.sqlDatabase;

public class SQLTableColumn {

    public enum ColumnType {
        TEXT, INTEGER, REAL;
    }

    public enum ColumnExtra {
        NONE(""), PRIMARY_KEY("PRIMARY KEY"), NOT_NULL("NOT NULL");

        private String name;

        ColumnExtra(String name) {
            this.name = name;
        }

        @Override
        public String toString() {
            return name;
        }
    }

    private String title;
    private ColumnType type;
    private ColumnExtra extra;

    public SQLTableColumn(String title, ColumnType type, ColumnExtra extra) {
        this.title = title;
        this.type = type;
        this.extra = extra;
    }

    public SQLTableColumn(String title, ColumnType type) {
        this.title = title;
        this.type = type;
        this.extra = ColumnExtra.NOT_NULL;
    }

    public String getKey() {
        return title;
    }

    @Override
    public String toString() {
        return title + " " + type.toString() + " " + extra.toString();
    }
}