Line data Source code
1 4 : (ns schemas.api.class-templates
2 : (:require
3 : [schemas.types :as types-schemas]))
4 :
5 :
6 4 : (def ClassTemplateRequestSchema
7 28 : [:map {:swagger/title "ClassTemplateRequestSchema"
8 : :swagger/description "Request payload for creating or updating a class template"}
9 8 : [:name
10 44 : [:string {:min 1
11 : :max 255
12 : :description "Class template name"
13 : :example "Beginner"}]]
14 20 : [:max-players {:optional true}
15 8 : [:maybe
16 36 : [:int {:min 1
17 : :description "Maximum number of players allowed"
18 : :example 16}]]]])
19 :
20 :
21 4 : (def ClassTemplatePathParamsSchema
22 20 : [:map {:swagger/title "ClassTemplatePathParamsSchema"}
23 28 : [:class-template-uuid {:description "Class template UUID in v7 format"
24 : :example "550e8400-e29b-41d4-a716-446655440000"}
25 4 : types-schemas/UuidString]])
26 :
27 :
28 4 : (def ClassTemplateAndTemplatePathParamsSchema
29 20 : [:map {:swagger/title "ClassTemplateAndTemplatePathParamsSchema"}
30 28 : [:class-template-uuid {:description "Class template UUID in v7 format"
31 : :example "550e8400-e29b-41d4-a716-446655440000"}
32 4 : types-schemas/UuidString]
33 28 : [:template-uuid {:description "Template UUID in v7 format"
34 : :example "550e8400-e29b-41d4-a716-446655440000"}
35 4 : types-schemas/UuidString]])
36 :
37 :
38 4 : (def ClassTemplateTransferPathParamsSchema
39 20 : [:map {:swagger/title "ClassTemplateTransferPathParamsSchema"}
40 28 : [:template-uuid {:description "Template UUID in v7 format"
41 : :example "550e8400-e29b-41d4-a716-446655440000"}
42 4 : types-schemas/UuidString]
43 28 : [:class-template-uuid {:description "Target class template UUID in v7 format"
44 : :example "550e8400-e29b-41d4-a716-446655440000"}
45 4 : types-schemas/UuidString]
46 28 : [:source-class-uuid {:description "Source class template UUID in v7 format"
47 : :example "550e8400-e29b-41d4-a716-446655440000"}
48 4 : types-schemas/UuidString]])
49 :
50 :
51 4 : (def ClassTemplateSwapPathParamsSchema
52 20 : [:map {:swagger/title "ClassTemplateSwapPathParamsSchema"}
53 28 : [:template-uuid {:description "Template UUID in v7 format"
54 : :example "550e8400-e29b-41d4-a716-446655440000"}
55 4 : types-schemas/UuidString]
56 28 : [:class-template-uuid {:description "First class template UUID in v7 format"
57 : :example "550e8400-e29b-41d4-a716-446655440000"}
58 4 : types-schemas/UuidString]
59 28 : [:other-class-uuid {:description "Second class template UUID in v7 format"
60 : :example "550e8400-e29b-41d4-a716-446655440000"}
61 4 : types-schemas/UuidString]])
62 :
63 :
64 4 : (def ClassTemplateParticipantPathParamsSchema
65 20 : [:map {:swagger/title "ClassTemplateParticipantPathParamsSchema"}
66 28 : [:template-uuid {:description "Template UUID in v7 format"
67 : :example "550e8400-e29b-41d4-a716-446655440000"}
68 4 : types-schemas/UuidString]
69 28 : [:class-template-uuid {:description "Class template UUID in v7 format"
70 : :example "550e8400-e29b-41d4-a716-446655440000"}
71 4 : types-schemas/UuidString]
72 28 : [:participant-id {:description "Participant UUID in v7 format"
73 : :example "550e8400-e29b-41d4-a716-446655440000"}
74 4 : types-schemas/UuidString]])
75 :
76 :
77 4 : (def ClassTemplateResponseSuccess201Body
78 28 : [:map {:swagger/title "ClassTemplateResponseSuccess201Body"
79 : :swagger/description "Successful class template creation response"}
80 28 : [:message [:string {:example "Class template created successfully."}]]
81 20 : [:data [:ref :domain/ClassTemplateRecord]]])
82 :
83 :
84 4 : (def ClassTemplateResponseSuccess200Body
85 28 : [:map {:swagger/title "ClassTemplateResponseSuccess200Body"
86 : :swagger/description "Successful class template retrieval/update response"}
87 28 : [:message [:string {:example "Class template retrieved successfully."}]]
88 8 : [:data
89 40 : [:or [:ref :domain/ClassTemplateRecord] [:sequential [:ref :domain/ClassTemplateRecord]]]]])
90 :
91 :
92 4 : (def ClassTemplateListResponseSuccess200Body
93 28 : [:map {:swagger/title "ClassTemplateListResponseSuccess200Body"
94 : :swagger/description "Successful class templates list retrieval response"}
95 28 : [:message [:string {:example "Class templates retrieved successfully."}]]
96 28 : [:data [:sequential [:ref :domain/ClassTemplateRecord]]]])
97 :
98 :
99 4 : (def ClassTemplateResponseError400Body
100 28 : [:map {:swagger/title "ClassTemplateResponseError400Body"
101 : :swagger/description "Class template operation error response"}
102 28 : [:message [:string {:example "Invalid class template data."}]]
103 12 : [:error :map]])
104 :
105 :
106 4 : (def ClassTemplateResponseError404Body
107 28 : [:map {:swagger/title "ClassTemplateResponseError404Body"
108 : :swagger/description "Class template not found response"}
109 28 : [:message [:string {:example "Class template not found."}]]
110 12 : [:error :map]])
111 :
112 :
113 4 : (def ClassTemplateDeleteResponseSuccess200Body
114 28 : [:map {:swagger/title "ClassTemplateDeleteResponseSuccess200Body"
115 : :swagger/description "Successful class template deletion response"}
116 28 : [:message [:string {:example "Class template deleted successfully."}]]])
117 :
118 :
119 4 : (def ClassTemplateResponseSchema
120 : "Union of possible class template create/update responses."
121 8 : [:or
122 40 : [:map [:status [:= 200]] [:body ClassTemplateResponseSuccess200Body]]
123 40 : [:map [:status [:= 201]] [:body ClassTemplateResponseSuccess201Body]]
124 40 : [:map [:status [:= 400]] [:body ClassTemplateResponseError400Body]]
125 40 : [:map [:status [:= 404]] [:body ClassTemplateResponseError404Body]]])
126 :
127 :
128 4 : (def ClassTemplateListResponseSchema
129 : "Response for listing class templates by event template."
130 8 : [:or
131 40 : [:map [:status [:= 200]] [:body ClassTemplateListResponseSuccess200Body]]
132 40 : [:map [:status [:= 400]] [:body ClassTemplateResponseError400Body]]])
133 :
134 :
135 4 : (def ClassTemplateDeleteResponseSchema
136 : "Response for deleting a class template."
137 8 : [:or
138 40 : [:map [:status [:= 200]] [:body ClassTemplateDeleteResponseSuccess200Body]]
139 40 : [:map [:status [:= 404]] [:body ClassTemplateResponseError404Body]]])
140 :
141 :
142 4 : (def ClassTemplateParticipantDeleteResponseSuccess200Body
143 28 : [:map {:swagger/title "ClassTemplateParticipantDeleteResponseSuccess200Body"
144 : :swagger/description "Successful class template participant removal response"}
145 28 : [:message [:string {:example "Participant removed from class template successfully."}]]])
146 :
147 :
148 4 : (def ClassTemplateParticipantDeleteResponseSchema
149 : "Response for removing a participant from a class template.
150 : Does not affect template registration."
151 8 : [:or
152 40 : [:map [:status [:= 200]] [:body ClassTemplateParticipantDeleteResponseSuccess200Body]]
153 40 : [:map [:status [:= 400]] [:body ClassTemplateResponseError400Body]]
154 40 : [:map [:status [:= 404]] [:body ClassTemplateResponseError404Body]]])
155 :
156 :
157 4 : (def ClassTemplateParticipantUpdateResponseSuccess200Body
158 20 : [:map {:swagger/title "ClassTemplateParticipantUpdateResponseSuccess200Body"}
159 12 : [:message :string]
160 20 : [:data [:ref :domain/ClassTemplateParticipantRecord]]])
161 :
162 :
163 4 : (def ClassTemplateParticipantUpdateResponseSchema
164 : "Response for updating a class template participant (e.g. status)."
165 8 : [:or
166 40 : [:map [:status [:= 200]] [:body ClassTemplateParticipantUpdateResponseSuccess200Body]]
167 40 : [:map [:status [:= 400]] [:body ClassTemplateResponseError400Body]]
168 40 : [:map [:status [:= 404]] [:body ClassTemplateResponseError404Body]]])
169 :
170 :
171 4 : (def ClassTemplateBulkAddFromTemplateResponseSuccess200Body
172 28 : [:map {:swagger/title "ClassTemplateBulkAddFromTemplateResponseSuccess200Body"
173 : :swagger/description "Successful bulk-add participants from template response"}
174 28 : [:message [:string {:example "Participants added to class template successfully."}]]
175 8 : [:data
176 8 : [:map
177 8 : [:added-count
178 36 : [:int {:min 0
179 : :description "Number of participants added"
180 : :example 5}]]
181 8 : [:skipped-count
182 36 : [:int {:min 0
183 : :description "Number of participants skipped"
184 : :example 2}]]]]])
185 :
186 :
187 4 : (def ClassTemplateBulkAddFromTemplateResponseSchema
188 : "Response for bulk-adding template participants to a class template.
189 : Invalid path params surface as 400 via the parameter-validation middleware.
190 : Internal/DB failures surface as 5xx via the exception middleware, so only the
191 : 200 success, 400 bad-request and 404 not-found contracts are declared here."
192 8 : [:or
193 40 : [:map [:status [:= 200]] [:body ClassTemplateBulkAddFromTemplateResponseSuccess200Body]]
194 40 : [:map [:status [:= 400]] [:body ClassTemplateResponseError400Body]]
195 40 : [:map [:status [:= 404]] [:body ClassTemplateResponseError404Body]]])
196 :
197 :
198 4 : (def ClassTemplateBulkCopyResponseSuccess200Body
199 28 : [:map {:swagger/title "ClassTemplateBulkCopyResponseSuccess200Body"
200 : :swagger/description "Successful bulk-copy participants between class templates response"}
201 28 : [:message [:string {:example "Participants copied to class template successfully."}]]
202 8 : [:data
203 8 : [:map
204 8 : [:added-count
205 36 : [:int {:min 0
206 : :description "Number of participants added to the target class template"
207 : :example 5}]]
208 8 : [:skipped-count
209 36 : [:int {:min 0
210 : :description "Number of participants skipped (already in target or capacity reached)"
211 : :example 2}]]]]])
212 :
213 :
214 4 : (def ClassTemplateBulkCopyResponseSchema
215 : "Response for bulk-copying participants between class templates."
216 8 : [:or
217 40 : [:map [:status [:= 200]] [:body ClassTemplateBulkCopyResponseSuccess200Body]]
218 40 : [:map [:status [:= 400]] [:body ClassTemplateResponseError400Body]]
219 40 : [:map [:status [:= 404]] [:body ClassTemplateResponseError404Body]]])
220 :
221 :
222 4 : (def ClassTemplateBulkMoveResponseSuccess200Body
223 28 : [:map {:swagger/title "ClassTemplateBulkMoveResponseSuccess200Body"
224 : :swagger/description "Successful bulk-move participants between class templates response"}
225 28 : [:message [:string {:example "Participants moved to class template successfully."}]]
226 8 : [:data
227 8 : [:map
228 8 : [:moved-count
229 36 : [:int {:min 0
230 : :description "Number of participants moved to the target class template"
231 : :example 5}]]
232 8 : [:skipped-count
233 36 : [:int {:min 0
234 : :description "Number of participants skipped (shared or capacity reached)"
235 : :example 2}]]]]])
236 :
237 :
238 4 : (def ClassTemplateBulkMoveResponseSchema
239 : "Response for bulk-moving participants between class templates."
240 8 : [:or
241 40 : [:map [:status [:= 200]] [:body ClassTemplateBulkMoveResponseSuccess200Body]]
242 40 : [:map [:status [:= 400]] [:body ClassTemplateResponseError400Body]]
243 40 : [:map [:status [:= 404]] [:body ClassTemplateResponseError404Body]]])
244 :
245 :
246 4 : (def ClassTemplateSwapResponseSuccess200Body
247 28 : [:map {:swagger/title "ClassTemplateSwapResponseSuccess200Body"
248 : :swagger/description "Successful participant swap between class templates response"}
249 28 : [:message [:string {:example "Participants swapped between class templates successfully."}]]
250 8 : [:data
251 8 : [:map
252 8 : [:moved-to-a-count
253 36 : [:int {:min 0
254 : :description "Number of participants moved from B into A"
255 : :example 3}]]
256 8 : [:moved-to-b-count
257 36 : [:int {:min 0
258 : :description "Number of participants moved from A into B"
259 : :example 4}]]
260 8 : [:skipped-count
261 36 : [:int {:min 0
262 : :description "Number of shared participants left unchanged"
263 : :example 1}]]]]])
264 :
265 :
266 4 : (def ClassTemplateSwapResponseSchema
267 : "Response for swapping participants between two class templates."
268 8 : [:or
269 40 : [:map [:status [:= 200]] [:body ClassTemplateSwapResponseSuccess200Body]]
270 40 : [:map [:status [:= 400]] [:body ClassTemplateResponseError400Body]]
271 40 : [:map [:status [:= 404]] [:body ClassTemplateResponseError404Body]]])
|