import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { CockroachColumn, CockroachColumnWithArrayBuilder } from "./common.js";
class CockroachVarcharBuilder extends CockroachColumnWithArrayBuilder {
  static [entityKind] = "CockroachVarcharBuilder";
  constructor(name, config) {
    super(name, "string", "CockroachVarchar");
    this.config.length = config.length;
    this.config.enumValues = config.enum;
  }
  /** @internal */
  build(table) {
    return new CockroachVarchar(
      table,
      this.config
    );
  }
}
class CockroachVarchar extends CockroachColumn {
  static [entityKind] = "CockroachVarchar";
  length = this.config.length;
  enumValues = this.config.enumValues;
  getSQLType() {
    return this.length === void 0 ? `varchar` : `varchar(${this.length})`;
  }
}
function varchar(a, b = {}) {
  const { name, config } = getColumnNameAndConfig(a, b);
  return new CockroachVarcharBuilder(name, config);
}
export {
  CockroachVarchar,
  CockroachVarcharBuilder,
  varchar
};
//# sourceMappingURL=varchar.js.map