-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMPRouteProperty.ts
83 lines (78 loc) · 1.74 KB
/
MPRouteProperty.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
* A property of of a route.
*
* @export
* @class MPRouteProperty
* @typedef {MPRouteProperty}
*/
export default class MPRouteProperty {
/**
* Creates an instance of MPRouteProperty.
*
* @constructor
* @private
* @param {?string} [text]
* @param {?number} [value]
* @param {?string} [timeZone]
*/
private constructor(
public readonly value?: number,
public readonly text?: string,
public readonly timeZone?: string,
) { }
/**
* Creator for MPRouteProperty, used to decode JSON from the MapsIndoors SDK.
*
* @public
* @static
* @param {MPRoutePropertyParams} object
* @returns {MPRouteProperty}
*/
public static create(object: MPRoutePropertyParams): MPRouteProperty {
return new MPRouteProperty(
object?.value,
object?.text,
object?.time_zone,
);
}
/**
* Parses the object to a JSON object that is compatible with the MapsIndoors SDK.
*
* @public
* @returns {MPRoutePropertyParams}
*/
public toJSON(): MPRoutePropertyParams {
return {
value: this.value,
text: this.text,
time_zone: this.timeZone,
};
}
}
/**
* Parameter interface for {@link MPRouteProperty}.
*
* @export
* @interface MPRoutePropertyParams
* @typedef {MPRoutePropertyParams}
*/
export interface MPRoutePropertyParams {
/**
* The value of the property.
*
* @type {?number}
*/
value?: number,
/**
* Accompanying text to the value.
*
* @type {?string}
*/
text?: string,
/**
* The timezone of the property.
*
* @type {?string}
*/
time_zone?: string,
}