import { Zone } from './../zones/zone';

export class Program {
  id: number = 0;
  name: string;
  scheduleItems: ProgramScheduleItem[] = [];
  programScheduleType: ProgramScheduleType = ProgramScheduleType.ManualOnly;
  startTimeHours: number = 0;
  startTimeMinutes: number = 0;
  monday: boolean;
  tuesday: boolean;
  wednesday: boolean;
  thursday: boolean;
  friday: boolean;
  saturday: boolean;
  sunday: boolean;
  
  getRunningTime(): number {
    return this.scheduleItems
      .map(item => item.minutes)
      .reduce((prev, curr) => prev + curr, 0);
  }
}

export class ProgramScheduleItem {
  zone: Zone;
  minutes: number;
}

export enum ProgramScheduleType {
  ManualOnly = 0,
  AllDays = 1,
  OddDays = 2,
  EvenDays = 3,
  DaysOfWeek = 4
}

import { Zone } from './../zones/zone';

export class Program {
  id: number;
  name: string;
  scheduleItems: ProgramScheduleItem[];
  programScheduleType: ProgramScheduleType;
  startTimeHours: number;
  startTimeMinutes: number;
  monday: boolean;
  tuesday: boolean;
  wednesday: boolean;
  thursday: boolean;
  friday: boolean;
  saturday: boolean;
  sunday: boolean;
  
  constructor() {
    this.scheduleItems = [];
  }
  
  getRunningTime(): number {
    return this.scheduleItems
      .map(item => item.minutes)
      .reduce((prev, curr) => prev + curr, 0);
  }
}

export class ProgramScheduleItem {
  zone: Zone;
  minutes: number;
}

export enum ProgramScheduleType {
  ManualOnly = 0,
  AllDays = 1,
  OddDays = 2,
  EvenDays = 3,
  DaysOfWeek = 4
}

--- 
+++ 
@@ -1,12 +1,12 @@
 import { Zone } from './../zones/zone';
 
 export class Program {
-  id: number;
+  id: number = 0;
   name: string;
-  scheduleItems: ProgramScheduleItem[];
-  programScheduleType: ProgramScheduleType;
-  startTimeHours: number;
-  startTimeMinutes: number;
+  scheduleItems: ProgramScheduleItem[] = [];
+  programScheduleType: ProgramScheduleType = ProgramScheduleType.ManualOnly;
+  startTimeHours: number = 0;
+  startTimeMinutes: number = 0;
   monday: boolean;
   tuesday: boolean;
   wednesday: boolean;
@@ -14,10 +14,6 @@
   friday: boolean;
   saturday: boolean;
   sunday: boolean;
-  
-  constructor() {
-    this.scheduleItems = [];
-  }
   
   getRunningTime(): number {
     return this.scheduleItems
Add some sensible default values
