import { AxiosInstance } from 'axios'; import { BaseRequestModel } from './models'; import { FormWithRelations } from './form'; import { UserWithRelations } from './user'; import { BaseRequestModelInterface } from './interfaces'; import { belongsTo, hasMany } from './decorators'; import { AddressData, UserData, FormData, PersonData } from '../types'; import { PersonWithRelations } from './person'; @belongsTo({ urlPath: 'form', classProp: 'form' }) @belongsTo({ urlPath: 'user', classProp: 'user' }) @hasMany({ urlPath: 'persons', classProp: 'persons' }) export class Address extends BaseRequestModel implements BaseRequestModelInterface { constructor(api: AxiosInstance) { super(api, '/addresses'); } } export interface AddressRelations { form?: FormWithRelations; user?: UserWithRelations; persons?: PersonWithRelations[]; } export type AddressWithRelations = Address & AddressRelations;