/**
 * Facebook PSID 登录请求 DTO
 */
import {
  FacebookPsidLoginRequestSchema,
  type FacebookPsidLoginRequestInput,
  type FacebookPsidLoginRequestData,
} from "@/data/schemas/auth/request/facebook_psid_login_request";

export class FacebookPsidLoginRequest {
  private constructor(input: FacebookPsidLoginRequestInput) {
    const data = FacebookPsidLoginRequestSchema.parse(input);
    Object.assign(this, data);
    Object.freeze(this);
  }

  static from(input: FacebookPsidLoginRequestInput): FacebookPsidLoginRequest {
    return new FacebookPsidLoginRequest(input);
  }

  static fromJson(json: unknown): FacebookPsidLoginRequest {
    return FacebookPsidLoginRequest.from(
      json as FacebookPsidLoginRequestInput,
    );
  }

  toJson(): FacebookPsidLoginRequestData {
    return FacebookPsidLoginRequestSchema.parse(this);
  }
}
