-
Notifications
You must be signed in to change notification settings - Fork 9
/
preference.ts
46 lines (35 loc) · 880 Bytes
/
preference.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { PreferenceModel } from '../types/models';
import { PreferenceParameters } from '../types/parameters';
const NEXT_AVAILABLE = 1;
const CERTAIN_DAYS = 2;
export default class Preference implements PreferenceModel {
protected attributes: PreferenceParameters;
constructor() {
this.attributes = {
day: null,
end: null,
start: null,
type: null,
}
}
public between(start: string, end: string): this {
this.attributes.end = end;
this.attributes.start = start;
return this;
}
public next(): this {
this.attributes.type = NEXT_AVAILABLE;
return this;
}
public on(day: number): this {
this.attributes.day = day;
this.attributes.type = CERTAIN_DAYS;
return this;
}
static get NEXT_AVAILABLE() {
return NEXT_AVAILABLE;
}
static get CERTAIN_DAYS() {
return CERTAIN_DAYS;
}
}