import { baseAPI } from '@/shared/api/base-api';

import { CorporateInfoResponse } from '../model/types/corporate-client-info.type';
import {
  CorporateTransactionRequest,
  CorporateTransactionResponse,
} from '../model/types/corporate-transactions.type';

export const corporateApi = baseAPI.injectEndpoints({
  endpoints: (builder) => ({
    fetchMyCorporateInfo: builder.query<CorporateInfoResponse, any>({
      query: () => {
        return {
          url: '/corporate/info',
        };
      },
    }),
    fetchCorporateTransactions: builder.query<
      CorporateTransactionResponse,
      CorporateTransactionRequest
    >({
      query: (request) => {
        return {
          url: '/corporate/transactions',
          params: request,
        };
      },
    }),
  }),
});

export const {
  useFetchMyCorporateInfoQuery,
  useFetchCorporateTransactionsQuery,
} = corporateApi;
