You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.3 KiB

import { observable } from "mobx";
export class Section {
@observable
public name: string = "";
@observable
public state: boolean = false;
}
export interface ITimeOfDay {
hour: number;
minute: number;
second: number;
millisecond: number;
}
export enum Weekday {
Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday,
}
export class Schedule {
public times: ITimeOfDay[] = [];
public weekdays: Weekday[] = [];
public from?: Date = null;
public to?: Date = null;
}
export interface IProgramItem {
// the section number
section: number;
// duration in seconds
duration: number;
}
export class Program {
@observable
public name: string = "";
@observable
public enabled: boolean = false;
@observable
public schedule: Schedule = new Schedule();
@observable
public sequence: IProgramItem[] = [];
@observable
public running: boolean = false;
}
export abstract class SprinklersDevice {
@observable
public connected: boolean = false;
@observable
public sections: Section[] = [];
@observable
public programs: Program[] = [];
abstract get id(): string;
}
export interface ISprinklersApi {
start();
getDevice(id: string): SprinklersDevice;
removeDevice(id: string);
}