import { AxiosInstance } from 'axios'; import { BaseRequestModel } from './models'; import { FormWithRelations } from './form'; import { UserWithRelations } from './user'; import { CreditWithRelations } from './credit'; import { KycWithRelations } from './kyc'; import { BaseRequestModelInterface } from './interfaces'; import { belongsTo, hasMany, hasOne } from './decorators'; import { UserData, PersonData, FormData, CreditData, KycData, AddressData, } from '../types'; import { AddressWithRelations } from './address'; @belongsTo({ urlPath: 'user', classProp: 'user' }) @belongsTo({ urlPath: 'form', classProp: 'form' }) @belongsTo({ urlPath: 'address', classProp: 'address', }) @hasOne({ urlPath: 'kyc', classProp: 'kyc' }) @hasMany({ urlPath: 'credits', classProp: 'credits' }) export class Person extends BaseRequestModel implements BaseRequestModelInterface { constructor(api: AxiosInstance) { super(api, '/persons'); } } export interface PersonRelations { user?: UserWithRelations; form?: FormWithRelations; credits?: CreditWithRelations[]; kyc?: KycWithRelations; address?: AddressWithRelations; } export type PersonWithRelations = Person & PersonRelations;