package com.rthoni.intellij.codefromds.dbo.template;

/**
 * Created by robin on 11/18/16.
 */
public class ColumnDataSourceDbo {

    private String _name;

    private boolean _isPrimary;

    private boolean _isSelected;

    private SqlTypeDbo _sqlType;

    private boolean _notNull;

    private String _defaultValue;

    public String getName() {
        return _name;
    }

    public void setName(String name) {
        _name = name;
    }

    public boolean isPrimary() {
        return _isPrimary;
    }

    public void setPrimary(boolean primary) {
        _isPrimary = primary;
    }

    public boolean isSelected() {
        return _isSelected;
    }

    public void setSelected(boolean selected) {
        _isSelected = selected;
    }

    public String getType() {
        return _sqlType != null ? _sqlType.getLanguageType() : null;
    }

    public SqlTypeDbo getSqlType() {
        return _sqlType;
    }

    public void setSqlType(SqlTypeDbo sqlType) {
        _sqlType = sqlType;
    }

    public boolean isNotNull() {
        return _notNull;
    }

    public void setNotNull(boolean notNull) {
        _notNull = notNull;
    }

    public boolean isTypeNotNull() {
        return _sqlType != null && _sqlType.isLanguageTypeNotNull();
    }

    public String getDefaultValue() {
        return _defaultValue;
    }

    public boolean hasDefaultValue()
    {
        return _defaultValue != null && !_defaultValue.equals("");
    }

    public void setDefaultValue(String defaultValue) {
        _defaultValue = defaultValue;
    }
}
