import { plainToInstance } from 'class-transformer' ; import type { ClassTransformOptions } from 'class-transformer' ; import { Distance } from '../model/distance' ; import type { DistanceDetailsInterface } from '../interface' ; import type { AbstractHttpProvider } from '../model' ; import { AbstractTransformer } from './abstract-transformer' ; export abstract class AbstractDistanceTransformer < HttpProviderClass extends AbstractHttpProvider = any , ProviderRawEntryType = any > extends AbstractTransformer < HttpProviderClass , ProviderRawEntryType > { abstract getDistance ( ) ; abstract getDuration ( ) ; async transform ( options ? ) { const distance = new Distance < ProviderRawEntryType > ( ) ; distance . provider = this . provider ; distance . distance = await this . getDistance ( ) ; distance . duration = await this . getDuration ( ) ; distance . raw = this . raw ; return plainToInstance < Distance < ProviderRawEntryType > , DistanceDetailsInterface < ProviderRawEntryType > > ( Distance , distance , options ) ; } }