import type { Contract } from '@entities' import type { HttpClient } from '@services' import type { ApiError, Response } from '@types' export type SendSmsOrEmailAuthSystemInput = { contractId: string ownerIsCompany: boolean authSystem: { owner_company_phone?: string owner_phone?: string owner_yousign_code_reception_method: 'sms' | 'email' } } const sendSmsOrEmailAuthSystem = (http: HttpClient) => { return { query: ( input: SendSmsOrEmailAuthSystemInput, ): Promise< Response< Contract<{ serialized: true; attributeType: 'contract' }>, undefined, ApiError > > => { const context = input.ownerIsCompany ? 'company' : 'individual' return http.put( `v1/owner_contracts/${input.contractId}?context=${context}`, { contract: input.authSystem }, ) }, } } export default sendSmsOrEmailAuthSystem