import { z } from 'zod';
import type { ReactNode } from 'react';
import type { UserProfileDto } from '../../profile/types';

import {
  loginSchema,
  tokenResponseSchema,
  logoutResponseSchema,
} from '../schemas/schemas';

export {
  loginSchema,
  tokenResponseSchema,
  logoutResponseSchema,
} from '../schemas/schemas';

export type LoginInput = z.infer<typeof loginSchema>;
export type TokenResponse = z.infer<typeof tokenResponseSchema>;
export type LogoutResponse = z.infer<typeof logoutResponseSchema>;

export interface ApiError {
  message: string;
  statusCode?: number;
}

export interface AxiosErrorResponse {
  response?: {
    data?: {
      message?: string;
    };
  };
}

export interface AuthLoginProps {
  title?: string;
  subtitle?: ReactNode;
  subtext?: ReactNode;
}

export interface AuthState {
  user: UserProfileDto | null;
  isAuthenticated: boolean;
  setUser: (user: UserProfileDto | null) => void;
  logout: () => void;
  hydrate: () => void;
}
