import { IGetProfileResponse_DTO } from "@shared/contexts";

export type SuccessNotificationResponse = {
  message: string;
  description?: string;
};

export type PermissionResponse = unknown;

export type ProfileResponse = IGetProfileResponse_DTO | null;

export type AuthActionCheckResponse = {
  authenticated: boolean;
  redirectTo?: string;
  logout?: boolean;
  error?: Error;
};

export type AuthActionOnErrorResponse = {
  redirectTo?: string;
  logout?: boolean;
  error?: Error;
};

export type AuthActionResponse = {
  success: boolean;
  redirectTo?: string;
  error?: Error;
  [key: string]: unknown;
  successNotification?: SuccessNotificationResponse;
};

export interface IAuthActions {
  login: (params: any) => Promise<AuthActionResponse>;
  logout: (params: any) => Promise<AuthActionResponse>;
  check: () => Promise<AuthActionCheckResponse>;
  onError?: (error: any) => Promise<AuthActionOnErrorResponse>;
  register?: (params: unknown) => Promise<AuthActionResponse>;
  forgotPassword?: (params: unknown) => Promise<AuthActionResponse>;
  updatePassword?: (params: unknown) => Promise<AuthActionResponse>;
  getPermissions?: (params?: Record<string, unknown>) => Promise<PermissionResponse>;
  getProfile?: (params?: unknown) => Promise<ProfileResponse>;
}
