import { Type } from './Type.js';
/** Maps a database UUID column to a JS `string`, with platform-specific normalization. */
export class UuidType extends Type {
  getColumnType(prop, platform) {
    return platform.getUuidTypeDeclarationSQL(prop);
  }
  compareAsType() {
    return this.platform?.compareUuids() ?? 'string';
  }
  convertToDatabaseValue(value, platform) {
    if (value == null) {
      return value;
    }
    return platform.convertUuidToDatabaseValue(value);
  }
  convertToJSValue(value, platform) {
    if (value == null) {
      return value;
    }
    return platform.convertUuidToJSValue(value);
  }
  ensureComparable() {
    return this.platform?.compareUuids() !== 'string';
  }
}
