import {
  UnlockPrivateRoomMomentRequestSchema,
  type UnlockPrivateRoomMomentRequestData,
  type UnlockPrivateRoomMomentRequestInput,
} from "@/data/schemas/private-room";

export class UnlockPrivateRoomMomentRequest {
  declare readonly expectedCost: number;

  private constructor(input: UnlockPrivateRoomMomentRequestInput) {
    const data = UnlockPrivateRoomMomentRequestSchema.parse(input);
    Object.assign(this, data);
    Object.freeze(this);
  }

  static from(
    input: UnlockPrivateRoomMomentRequestInput,
  ): UnlockPrivateRoomMomentRequest {
    return new UnlockPrivateRoomMomentRequest(input);
  }

  static fromJson(json: unknown): UnlockPrivateRoomMomentRequest {
    return UnlockPrivateRoomMomentRequest.from(
      json as UnlockPrivateRoomMomentRequestInput,
    );
  }

  toJson(): UnlockPrivateRoomMomentRequestData {
    return UnlockPrivateRoomMomentRequestSchema.parse(this);
  }
}
