-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand.schema.json
More file actions
172 lines (172 loc) · 6.56 KB
/
Copy pathcommand.schema.json
File metadata and controls
172 lines (172 loc) · 6.56 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://stepback.local/schema/agent-command-v2.json",
"title": "StepBack Agent Bridge command",
"type": "object",
"required": ["schemaVersion", "commandID", "verb", "payload"],
"properties": {
"schemaVersion": { "const": 2 },
"commandID": { "type": "string", "format": "uuid" },
"expectedUpdatedAt": { "type": "string", "format": "date-time" },
"verb": {
"enum": [
"createCustomWorkout", "updateCustomWorkout",
"createRoutine", "updateRoutine",
"createPlan", "updatePlan",
"activatePlan"
]
},
"payload": { "type": "object" }
},
"additionalProperties": false,
"allOf": [
{
"if": { "properties": { "verb": { "const": "createCustomWorkout" } } },
"then": { "properties": { "payload": { "$ref": "#/$defs/customWorkoutCreate" } } }
},
{
"if": { "properties": { "verb": { "const": "updateCustomWorkout" } } },
"then": { "properties": { "payload": { "$ref": "#/$defs/customWorkoutUpdate" } } }
},
{
"if": { "properties": { "verb": { "const": "createRoutine" } } },
"then": { "properties": { "payload": { "$ref": "#/$defs/routineCreate" } } }
},
{
"if": { "properties": { "verb": { "const": "updateRoutine" } } },
"then": { "properties": { "payload": { "$ref": "#/$defs/routineUpdate" } } }
},
{
"if": { "properties": { "verb": { "const": "createPlan" } } },
"then": { "properties": { "payload": { "$ref": "#/$defs/planCreate" } } }
},
{
"if": { "properties": { "verb": { "const": "updatePlan" } } },
"then": { "properties": { "payload": { "$ref": "#/$defs/planUpdate" } } }
},
{
"if": { "properties": { "verb": { "const": "activatePlan" } } },
"then": { "properties": { "payload": { "$ref": "#/$defs/planActivation" } } }
}
],
"$defs": {
"name": { "type": "string", "minLength": 1, "maxLength": 120, "pattern": "\\S" },
"customWorkoutBase": {
"type": "object",
"required": ["name", "categoryID"],
"properties": {
"id": { "type": "string", "minLength": 1 },
"name": { "$ref": "#/$defs/name" },
"categoryID": { "type": "string", "minLength": 1 },
"notes": { "type": ["string", "null"], "maxLength": 2000 }
},
"additionalProperties": false
},
"customWorkoutCreate": {
"$ref": "#/$defs/customWorkoutBase",
"not": { "required": ["id"] }
},
"customWorkoutUpdate": {
"$ref": "#/$defs/customWorkoutBase",
"required": ["id", "name", "categoryID"]
},
"routineStep": {
"type": "object",
"required": ["workoutID", "workSeconds", "sets", "setRestSeconds", "restAfterSeconds"],
"properties": {
"workoutID": { "type": "string", "minLength": 1 },
"workSeconds": { "type": "integer", "minimum": 5, "maximum": 600, "multipleOf": 5 },
"sets": { "type": "integer", "minimum": 1, "maximum": 20 },
"setRestSeconds": { "type": "integer", "minimum": 0, "maximum": 300, "multipleOf": 5 },
"restAfterSeconds": { "type": "integer", "minimum": 0, "maximum": 300, "multipleOf": 5 },
"repGuidance": { "type": ["integer", "null"], "minimum": 5, "maximum": 100, "multipleOf": 5 }
},
"additionalProperties": false
},
"routineBase": {
"type": "object",
"required": ["name", "steps"],
"properties": {
"id": { "type": "string", "minLength": 1 },
"name": { "$ref": "#/$defs/name" },
"steps": { "type": "array", "maxItems": 200, "items": { "$ref": "#/$defs/routineStep" } }
},
"additionalProperties": false
},
"routineCreate": {
"$ref": "#/$defs/routineBase",
"not": { "required": ["id"] },
"properties": { "steps": { "minItems": 1 } }
},
"routineUpdate": {
"$ref": "#/$defs/routineBase",
"required": ["id", "name", "steps"]
},
"routineReference": {
"type": "object",
"required": ["fromCommand"],
"properties": { "fromCommand": { "type": "string", "format": "uuid" } },
"additionalProperties": false
},
"planSlot": {
"type": "object",
"properties": {
"routineID": { "type": "string", "minLength": 1 },
"routineRef": { "$ref": "#/$defs/routineReference" }
},
"oneOf": [
{ "required": ["routineID"], "not": { "required": ["routineRef"] } },
{ "required": ["routineRef"], "not": { "required": ["routineID"] } }
],
"additionalProperties": false
},
"planDay": {
"type": "object",
"required": ["weekday", "slots"],
"properties": {
"weekday": { "type": "integer", "minimum": 1, "maximum": 7 },
"slots": { "type": "array", "maxItems": 100, "items": { "$ref": "#/$defs/planSlot" } }
},
"additionalProperties": false
},
"planBase": {
"type": "object",
"required": ["name", "days"],
"properties": {
"id": { "type": "string", "minLength": 1 },
"name": { "$ref": "#/$defs/name" },
"days": { "$ref": "#/$defs/planDays" }
},
"additionalProperties": false
},
"planDays": {
"type": "array",
"minItems": 7,
"maxItems": 7,
"items": { "$ref": "#/$defs/planDay" },
"allOf": [
{ "contains": { "properties": { "weekday": { "const": 1 } }, "required": ["weekday"] }, "minContains": 1, "maxContains": 1 },
{ "contains": { "properties": { "weekday": { "const": 2 } }, "required": ["weekday"] }, "minContains": 1, "maxContains": 1 },
{ "contains": { "properties": { "weekday": { "const": 3 } }, "required": ["weekday"] }, "minContains": 1, "maxContains": 1 },
{ "contains": { "properties": { "weekday": { "const": 4 } }, "required": ["weekday"] }, "minContains": 1, "maxContains": 1 },
{ "contains": { "properties": { "weekday": { "const": 5 } }, "required": ["weekday"] }, "minContains": 1, "maxContains": 1 },
{ "contains": { "properties": { "weekday": { "const": 6 } }, "required": ["weekday"] }, "minContains": 1, "maxContains": 1 },
{ "contains": { "properties": { "weekday": { "const": 7 } }, "required": ["weekday"] }, "minContains": 1, "maxContains": 1 }
]
},
"planCreate": {
"$ref": "#/$defs/planBase",
"not": { "required": ["id"] }
},
"planUpdate": {
"$ref": "#/$defs/planBase",
"required": ["id", "name", "days"]
},
"planActivation": {
"type": "object",
"required": ["id"],
"properties": { "id": { "type": "string", "minLength": 1 } },
"additionalProperties": false
}
}
}