/**
 * Facebook 登录请求 DTO
 */
import {
  FacebookLoginRequestSchema,
  type FacebookLoginRequestInput,
  type FacebookLoginRequestData,
} from "@/data/schemas/auth/facebook_login_request";

export class FacebookLoginRequest {
  declare readonly accessToken: string;
  declare readonly platform: string;
  declare readonly guestId: string;
  declare readonly isTestAccount: boolean;

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

  static from(input: FacebookLoginRequestInput): FacebookLoginRequest {
    return new FacebookLoginRequest(input);
  }

  static fromJson(json: unknown): FacebookLoginRequest {
    return FacebookLoginRequest.from(json as FacebookLoginRequestInput);
  }

  toJson(): FacebookLoginRequestData {
    return FacebookLoginRequestSchema.parse(this);
  }
}
