import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { CockroachColumn, CockroachColumnWithArrayBuilder } from "./common.js";
class CockroachTimeBuilder extends CockroachColumnWithArrayBuilder {
  constructor(name, withTimezone, precision) {
    super(name, "string", "CockroachTime");
    this.withTimezone = withTimezone;
    this.precision = precision;
    this.config.withTimezone = withTimezone;
    this.config.precision = precision;
  }
  static [entityKind] = "CockroachTimeBuilder";
  /** @internal */
  build(table) {
    return new CockroachTime(
      table,
      this.config
    );
  }
}
class CockroachTime extends CockroachColumn {
  static [entityKind] = "CockroachTime";
  withTimezone;
  precision;
  constructor(table, config) {
    super(table, config);
    this.withTimezone = config.withTimezone;
    this.precision = config.precision;
  }
  getSQLType() {
    const precision = this.precision === void 0 ? "" : `(${this.precision})`;
    return `time${precision}${this.withTimezone ? " with time zone" : ""}`;
  }
}
function time(a, b = {}) {
  const { name, config } = getColumnNameAndConfig(a, b);
  return new CockroachTimeBuilder(name, config.withTimezone ?? false, config.precision);
}
export {
  CockroachTime,
  CockroachTimeBuilder,
  time
};
//# sourceMappingURL=time.js.map