import { ProgressMode } from "../enums/progress-mode.enum" ; import { YearToDateProgressConfigModel } from "./year-to-date-progress-config.model" ; import { ProgressConfig } from "../interfaces/progress-config" ; export class RollingProgressConfigModel extends YearToDateProgressConfigModel { constructor ( typesFilter , includeCommuteRide , includeIndoorRide , rollingDays ) { super ( typesFilter , includeCommuteRide , includeIndoorRide ) ; this . rollingDays = rollingDays ; } public readonly mode = ProgressMode . ROLLING ; public readonly rollingDays : number ; public static instanceFrom ( progressConfig ) { if ( progressConfig . mode !== ProgressMode . ROLLING ) { throw new Error ( "progressConfig.mode !== ProgressMode.ROLLING" ) ; } return new RollingProgressConfigModel ( progressConfig . activityTypes , progressConfig . includeCommuteRide , progressConfig . includeIndoorRide , ( < RollingProgressConfigModel > progressConfig ) . rollingDays ) ; } }