import { AxiosInstance } from 'axios'; import { BaseRequestModel } from './models'; import { UserWithRelations } from './user'; import { AddressWithRelations } from './address'; import { PersonWithRelations } from './person'; import { LoanPartWithRelations } from './loan-part'; import { TinkLoanWithRelations } from './tink-loan'; import { BaseRequestModelInterface } from './interfaces'; import { belongsTo, hasOne, hasMany } from './decorators'; import { AddressData, FormData, TinkLoanData, LoanPartData, PersonData, UserData, } from '../types'; @hasOne({ urlPath: 'address', classProp: 'address' }) @belongsTo({ urlPath: 'user', classProp: 'user' }) @hasMany({ urlPath: 'persons', classProp: 'persons' }) @hasMany({ urlPath: 'loan-parts', classProp: 'loanParts', }) @hasMany({ urlPath: 'tink-loans', classProp: 'tinkLoans', }) export class Form extends BaseRequestModel implements BaseRequestModelInterface { constructor(api: AxiosInstance) { super(api, '/forms'); } } export interface FormRelations { user: UserWithRelations; address?: AddressWithRelations; persons?: PersonWithRelations[]; loanParts?: LoanPartWithRelations[]; tinkLoans?: TinkLoanWithRelations[]; } export type FormWithRelations = Form & FormRelations;