/**
 * Facebook identity 绑定响应 DTO
 */
import {
  FacebookIdentityResponseSchema,
  type FacebookIdentityResponseInput,
  type FacebookIdentityResponseData,
} from "@/data/schemas/auth/response/facebook_identity_response";

export class FacebookIdentityResponse {
  private constructor(input: FacebookIdentityResponseInput) {
    const data = FacebookIdentityResponseSchema.parse(input);
    Object.assign(this, data);
    Object.freeze(this);
  }

  static from(input: FacebookIdentityResponseInput): FacebookIdentityResponse {
    return new FacebookIdentityResponse(input);
  }

  static fromJson(json: unknown): FacebookIdentityResponse {
    return FacebookIdentityResponse.from(
      json as FacebookIdentityResponseInput,
    );
  }

  toJson(): FacebookIdentityResponseData {
    return FacebookIdentityResponseSchema.parse(this);
  }
}
