import { ProgressType } from "../enums/progress-type.enum" ; export class ProgressModel { public year : number ; public dayOfYear : number ; public distance : number ; public time : number ; public elevation : number ; public count : number ; public isFuture : boolean ; constructor ( year , dayOfYear , distance , time , elevation , count , isFuture ? ) { this . year = year ; this . dayOfYear = dayOfYear ; this . distance = distance ; this . time = time ; this . elevation = elevation ; this . count = count ; this . isFuture = ( isFuture === true ) ? isFuture : false ; } public valueOf ( type ) { switch ( type ) { case ProgressType . DISTANCE : return this . distance ; case ProgressType . TIME : return this . time ; case ProgressType . ELEVATION : return this . elevation ; case ProgressType . COUNT : return this . count ; default : throw new Error ( "Unknown progress type: " + type ) ; } } }