/**
 * Facebook PSID 登录响应 DTO
 */
import {
  FacebookPsidLoginResponseSchema,
  type FacebookPsidLoginResponseInput,
  type FacebookPsidLoginResponseData,
} from "@/data/schemas/auth/response/facebook_psid_login_response";

export class FacebookPsidLoginResponse {
  private constructor(input: FacebookPsidLoginResponseInput) {
    const data = FacebookPsidLoginResponseSchema.parse(input);
    Object.assign(this, data);
    Object.freeze(this);
  }

  static from(
    input: FacebookPsidLoginResponseInput,
  ): FacebookPsidLoginResponse {
    return new FacebookPsidLoginResponse(input);
  }

  static fromJson(json: unknown): FacebookPsidLoginResponse {
    return FacebookPsidLoginResponse.from(
      json as FacebookPsidLoginResponseInput,
    );
  }

  toJson(): FacebookPsidLoginResponseData {
    return FacebookPsidLoginResponseSchema.parse(this);
  }
}
