package com.huangzj.protoplugin.mysql;

/** JDBC 列元数据（用于生成实体字段）。 */
public final class ColumnMeta {

    private final String name;
    private final int sqlType;
    private final String typeName;
    private final int columnSize;
    private final int decimalDigits;
    private final boolean nullable;
    private final boolean autoIncrement;

    public ColumnMeta(
            String name,
            int sqlType,
            String typeName,
            int columnSize,
            int decimalDigits,
            boolean nullable,
            boolean autoIncrement) {
        this.name = name;
        this.sqlType = sqlType;
        this.typeName = typeName != null ? typeName : "";
        this.columnSize = columnSize;
        this.decimalDigits = decimalDigits;
        this.nullable = nullable;
        this.autoIncrement = autoIncrement;
    }

    public String getName() {
        return name;
    }

    public int getSqlType() {
        return sqlType;
    }

    public String getTypeName() {
        return typeName;
    }

    public int getColumnSize() {
        return columnSize;
    }

    public int getDecimalDigits() {
        return decimalDigits;
    }

    public boolean isNullable() {
        return nullable;
    }

    public boolean isAutoIncrement() {
        return autoIncrement;
    }
}
