import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { CockroachColumn } from "./common.js";
import { CockroachDateColumnBaseBuilder } from "./date.common.js";
class CockroachDateBuilder extends CockroachDateColumnBaseBuilder {
  static [entityKind] = "CockroachDateBuilder";
  constructor(name) {
    super(name, "date", "CockroachDate");
  }
  /** @internal */
  build(table) {
    return new CockroachDate(
      table,
      this.config
    );
  }
}
class CockroachDate extends CockroachColumn {
  static [entityKind] = "CockroachDate";
  getSQLType() {
    return "date";
  }
  mapFromDriverValue(value) {
    return new Date(value);
  }
  mapToDriverValue(value) {
    return value.toISOString();
  }
}
class CockroachDateStringBuilder extends CockroachDateColumnBaseBuilder {
  static [entityKind] = "CockroachDateStringBuilder";
  constructor(name) {
    super(name, "string", "CockroachDateString");
  }
  /** @internal */
  build(table) {
    return new CockroachDateString(
      table,
      this.config
    );
  }
}
class CockroachDateString extends CockroachColumn {
  static [entityKind] = "CockroachDateString";
  getSQLType() {
    return "date";
  }
}
function date(a, b) {
  const { name, config } = getColumnNameAndConfig(a, b);
  if (config?.mode === "date") {
    return new CockroachDateBuilder(name);
  }
  return new CockroachDateStringBuilder(name);
}
export {
  CockroachDate,
  CockroachDateBuilder,
  CockroachDateString,
  CockroachDateStringBuilder,
  date
};
//# sourceMappingURL=date.js.map