/**
 * 退出登录响应 DTO
 */
import {
  LogoutResponseSchema,
  type LogoutResponseInput,
  type LogoutResponseData,
} from "@/data/schemas/auth/logout_response";

export class LogoutResponse {
  declare readonly success: boolean;

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

  static from(input: LogoutResponseInput): LogoutResponse {
    return new LogoutResponse(input);
  }

  static fromJson(json: unknown): LogoutResponse {
    return LogoutResponse.from(json as LogoutResponseInput);
  }

  toJson(): LogoutResponseData {
    return LogoutResponseSchema.parse(this);
  }
}
