import type { IAuthRepository } from '@/domain/repositories/auth.repository.interface';
import type { AdminUser, AuthTokens } from '@/domain/entities';
import { httpClient } from '../http/http.client';

class AuthRepository implements IAuthRepository {
  async login(
    identifier: string,
    password: string,
  ): Promise<{ user: AdminUser; tokens: AuthTokens }> {
    return httpClient.post('/api/v1/auth/login', { identifier, password });
  }

  async logout(): Promise<void> {
    await httpClient.post('/api/v1/auth/logout').catch(() => {});
  }
}

export const authRepository = new AuthRepository();
