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