import { v4 as uuidv4 } from 'uuid'
import { DomainError } from '@/shared/exceptions'

export class AssessmentId {
  constructor(public readonly value: string) {
    if (!value) {
      throw new DomainError('考核ID不能为空')
    }
  }

  static generate(): AssessmentId {
    return new AssessmentId(uuidv4())
  }

  static create(value: string): AssessmentId {
    return new AssessmentId(value)
  }

  equals(other: AssessmentId): boolean {
    return this.value === other.value
  }

  toString(): string {
    return this.value
  }
}
