import type { ClientContractPaymentTransaction, ClientContractType, ContractPayment, DestinationKind, } from '@entities' import { type HttpClient, type IncludeType, endpointMaker } from '@services' import type { ApiError, Response } from '../../../../types' export type GetClientContractInput = { clientContractId: string includes?: IncludeType } export type ClientContractHouse = { id: string type: string address: string bathrooms: number bedrooms: number capacity: number city: string contractInformationId: string createdAt: string currency: string currentUserIsSignatory: null destinationId: string | undefined firstPhotoId: string gpslatitude: string gpslongitude: string houseStyleId: string maxPrice: { CHF: number; EUR: number; GBP: number; USD: number } minPrice: { CHF: number; EUR: number; GBP: number; USD: number } name: string oldName: string privateToken?: string slug: { en: string fr: string } state: string | undefined zipCode: string } export type ClientContractDestination = { clusterizedName: { en: string fr: string } housesIds: string[] id: string kind: DestinationKind name: string type: 'destination' } export type ClientContractIncludedType = { contractPayments: ContractPayment | ContractPayment[] paymentTransactions: | ClientContractPaymentTransaction | ClientContractPaymentTransaction[] reviewers: { id: string email: string firstName: string lastName: string phone: string } houses: ClientContractHouse | ClientContractHouse[] destinations: ClientContractDestination } const getClientContract = (http: HttpClient) => { return { query: ( input: GetClientContractInput, ): Promise< Response > => { const query = endpointMaker({ includes: input.includes, }) return http.get( `v3/user/client_contracts/${input.clientContractId}${query}`, ) }, } } export default getClientContract