import api from '../../../shared/utils/api';

export interface AdminInfo {
  id: string;
  username: string;
  name: string;
  role: string;
  permissions: string[];
}

export interface LoginResponse {
  admin: AdminInfo;
  token: string;
}

export const authApi = {
  login: async (username: string, password: string): Promise<LoginResponse> => {
    const response = await api.post('/admin/login', { username, password });
    return response.data.data;
  },

  verify: async (): Promise<AdminInfo> => {
    const response = await api.get('/admin/verify');
    return response.data.data;
  },
};
