/** Request payload and query parameters for finding or creating a contact. */ interface FindOrCreateContactRequest { contactName: string; companyId: string; email: string; } /** Base contact data returned by the Contact List API. */ interface Contact { id: string; belongsTo: string; name: string; cpf: string | null; isActive: boolean; avatar: string | null; declinedMarketing: boolean; customField: Record; deletedAt: string | null; createdAt: string; updatedAt: string; categoryId: string | null; organizationId: string | null; } /** Contact returned by the Contact List API. */ interface ContactResponse extends Contact { } /** Contact phone returned when fetching a contact by identifier. */ interface FindContactByIdPhoneResponse { id: number; number: string; ddi: string; country: string; isWhatsapp: boolean; companyId: string; isActive: boolean; deletedAt: string | null; fullNumber: string; declinedMarketing: boolean; createdAt: string; updatedAt: string; contactId: string; } /** Contact email returned when fetching a contact by identifier. */ interface FindContactByIdEmailResponse { id: number; address: string; isActive: boolean; deletedAt: string | null; contactId: string; } /** Response returned by the Contact List API when fetching a contact by identifier. */ interface FindContactByIdResponse extends Contact { phones: FindContactByIdPhoneResponse[]; emails: FindContactByIdEmailResponse[]; organization: Record | null; category: Record | null; instagramProfile: Record[]; } /** Query parameters for searching WhatsApp accounts. Text filters are combined with OR within the company and portfolio scope. */ interface SearchWhatsappAccountsRequest { companyId?: string; businessPortfolioId?: string; filterBsuid?: string; filterContactName?: string; filterContactCpf?: string; filterPhone?: string; filterCategoryName?: string; filterOrganizationName?: string; includes?: 'phone'[]; contactInclude?: ('organization' | 'category' | 'phone' | 'email')[]; limit?: number; offset?: number; orderBy?: 'name' | 'bsuid' | 'createdAt'; } /** WhatsApp account returned by the Contact List API. */ interface WhatsappAccountResponse { id: string; companyId: string; contactId: string; businessPortfolioId: string; bsuid: string; phoneId: number | null; phoneNumber: string | null; createdAt: string; updatedAt: string; } /** WhatsApp account with its contact details returned by search. */ interface WhatsappAccountSearchItemResponse extends WhatsappAccountResponse { phone?: FindContactByIdPhoneResponse | null; contact: Contact & { organization?: { id: number; name: string; } | null; category?: { id: number; name: string; } | null; phones?: FindContactByIdPhoneResponse[]; emails?: FindContactByIdEmailResponse[]; }; } /** Paginated WhatsApp account search response. */ interface SearchWhatsappAccountsResponse { total: number; accounts: WhatsappAccountSearchItemResponse[]; } /** Query parameters for searching contact phones. */ interface GetContactPhonesParams { limit: number; offset: number; companyId: string; businessPortfolioId?: string; orderBy?: string; filter?: string; associations?: string[]; campaigns?: { isActive: boolean; }; excluding?: string[]; } /** Contact phone entity returned by the Contact List API. */ interface ContactPhoneResponse { id: number; contactId: string; number: string; ddi: string; declinedMarketing: boolean; contact: { name: string; avatar: string; category: { id: string; name: string; } | null; organization: { name: string; } | null; campaigns: { campaignId: string; }[]; whatsappAccounts?: WhatsappAccountResponse[]; }; } /** Paginated response returned by the Contact List API for phone search. */ interface ContactPhoneSearchResponse { phones: ContactPhoneResponse[]; } /** Contact category entity returned by the Contact List API. */ interface ContactCategoryResponse { id: string; name: string; } export type { Contact, ContactCategoryResponse, ContactPhoneResponse, ContactPhoneSearchResponse, ContactResponse, FindContactByIdEmailResponse, FindContactByIdPhoneResponse, FindContactByIdResponse, FindOrCreateContactRequest, GetContactPhonesParams, SearchWhatsappAccountsRequest, SearchWhatsappAccountsResponse, WhatsappAccountResponse, WhatsappAccountSearchItemResponse };