import httpClient from '@/shared/config/api/httpClient';
import { ProductListResult } from '@/shared/config/api/product/type';
import { API_URLS } from '@/shared/config/api/URLs';
import { AxiosResponse } from 'axios';
import { BannerRes } from './type';

export interface UserRes {
  address: null | string;
  created_at: string;
  date_joined: string;
  email: string;
  first_name: string;
  gender: 'M' | 'F';
  groups: [];
  id: null;
  is_active: boolean;
  is_staff: boolean;
  is_superuser: boolean;
  last_login: null | string;
  last_name: string;
  middle_name: null | string;
  password: string;
  person_id: number;
  region: null | string;
  tg_id: null | string;
  user_permissions: [];
  username: string;
}

export interface ProductRes {
  id: number;
  name: string;
  products: ProductListResult[];
}

export const banner_api = {
  async getBanner(): Promise<AxiosResponse<BannerRes[]>> {
    const res = await httpClient.get(API_URLS.Banner);
    return res;
  },
  async getMe(): Promise<AxiosResponse<UserRes>> {
    const res = await httpClient.get(API_URLS.Get_Me);
    return res;
  },

  async getAllProducts(): Promise<AxiosResponse<ProductRes[]>> {
    const res = await httpClient.get(API_URLS.ProductList);
    return res;
  },
};
