"use client";

/**
 * IAuthStorage 接口
 *
 * 对齐 Dart 端 `IAuthStorage`（lib/data/services/storage/iauth_storage.dart）：
 *   - loginToken / loginProvider / guestToken / deviceId / refreshToken / facebookId 字段的 CRUD
 *   - `clearAuthData()` 批量清空登录态
 *   - 所有方法返回 `Promise<Result<T>>`，与 Dart `Future<Result<T>>` 对齐
 */

import type { Result } from "@/utils";
import type { LoginStatus } from "@/data/dto/auth";

export interface IAuthStorage {
  getLoginToken(): Promise<Result<string | null>>;
  setLoginToken(token: string): Promise<Result<void>>;
  hasLoginToken(): Promise<Result<boolean>>;
  clearLoginToken(): Promise<Result<void>>;

  getLoginProvider(): Promise<Result<LoginStatus | null>>;
  setLoginProvider(provider: LoginStatus): Promise<Result<void>>;
  clearLoginProvider(): Promise<Result<void>>;

  getGuestToken(): Promise<Result<string | null>>;
  setGuestToken(token: string): Promise<Result<void>>;
  hasGuestToken(): Promise<Result<boolean>>;
  clearGuestToken(): Promise<Result<void>>;

  getDeviceId(): Promise<Result<string | null>>;
  setDeviceId(deviceId: string): Promise<Result<void>>;

  getRefreshToken(): Promise<Result<string | null>>;
  setRefreshToken(token: string): Promise<Result<void>>;
  clearRefreshToken(): Promise<Result<void>>;

  getFacebookId(): Promise<Result<string | null>>;
  setFacebookId(id: string): Promise<Result<void>>;
  clearFacebookId(): Promise<Result<void>>;

  clearAuthData(): Promise<Result<void>>;
}
