import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { MsSqlColumn, MsSqlColumnBuilder } from "./common.js";
class MsSqlCharBuilder extends MsSqlColumnBuilder {
  static [entityKind] = "MsSqlCharBuilder";
  /** @internal */
  constructor(name, config) {
    super(name, "string", "MsSqlChar");
    this.config.length = config.length;
    this.config.enum = config.enum;
    this.config.nonUnicode = config.nonUnicode;
  }
  /** @internal */
  build(table) {
    return new MsSqlChar(
      table,
      this.config
    );
  }
}
class MsSqlChar extends MsSqlColumn {
  static [entityKind] = "MsSqlChar";
  length = this.config.length;
  enumValues = this.config.enum;
  nonUnicode = this.config.nonUnicode;
  getSQLType() {
    return this.length === void 0 ? this.nonUnicode ? `nchar` : `char` : this.nonUnicode ? `nchar(${this.length})` : `char(${this.length})`;
  }
}
function char(a, b) {
  const { name, config } = getColumnNameAndConfig(a, b);
  return new MsSqlCharBuilder(name, { ...config, nonUnicode: false });
}
function nchar(a, b) {
  const { name, config } = getColumnNameAndConfig(a, b);
  return new MsSqlCharBuilder(name, {
    ...config,
    nonUnicode: true
  });
}
export {
  MsSqlChar,
  MsSqlCharBuilder,
  char,
  nchar
};
//# sourceMappingURL=char.js.map