Line data Source code
1 4 : (ns schemas.api.scoreboard)
2 :
3 :
4 4 : (def ScoreboardPendingMatchSchema
5 28 : [:map {:swagger/title "ScoreboardPendingMatch"
6 : :swagger/description
7 : "Known participants in an unresolved match that will decide two placements"}
8 20 : [:id [:ref :types/UuidString]]
9 20 : [:status [:= "pending"]]
10 8 : [:participants
11 32 : [:vector {:min 2
12 : :max 2}
13 : :map]]])
14 :
15 :
16 4 : (def ScoreboardPlacementSchema
17 20 : [:map {:swagger/title "ScoreboardPlacement"}
18 28 : [:place [:int {:min 1}]]
19 20 : [:participant [:maybe :map]]
20 20 : [:pending-match {:optional true}
21 4 : ScoreboardPendingMatchSchema]])
22 :
23 :
24 4 : (def ScoreboardGroupOrBracketEntrySchema
25 28 : [:map {:swagger/title "ScoreboardGroupOrBracketEntry"
26 : :swagger/description
27 : "Result block for a single group or for the (combined) main bracket of a draw"}
28 24 : [:type [:enum "group" "bracket"]]
29 20 : [:name [:maybe :string]]
30 20 : [:results [:sequential ScoreboardPlacementSchema]]])
31 :
32 :
33 4 : (def ScoreboardDrawEntrySchema
34 20 : [:map {:swagger/title "ScoreboardDrawEntry"}
35 20 : [:draw-uuid [:ref :types/UuidString]]
36 20 : [:draw-name [:maybe :string]]
37 20 : [:draw-type [:maybe :string]]
38 20 : [:results [:sequential ScoreboardGroupOrBracketEntrySchema]]])
39 :
40 :
41 4 : (def ScoreboardResponseSuccess200Body
42 20 : [:map {:swagger/title "ScoreboardResponseSuccess200Body"}
43 28 : [:message [:string {:example "Scoreboard retrieved successfully."}]]
44 20 : [:data [:sequential ScoreboardDrawEntrySchema]]])
45 :
46 :
47 4 : (def ScoreboardResponseError404Body
48 20 : [:map {:swagger/title "ScoreboardResponseError404Body"}
49 28 : [:message [:string {:example "Class not found."}]]
50 24 : [:error {:optional true}
51 : :any]])
52 :
53 :
54 4 : (def ScoreboardResponseError400Body
55 20 : [:map {:swagger/title "ScoreboardResponseError400Body"}
56 12 : [:message :string]
57 24 : [:error {:optional true}
58 : :any]])
59 :
60 :
61 4 : (def ScoreboardResponseSchema
62 8 : [:or
63 40 : [:map [:status [:= 200]] [:body ScoreboardResponseSuccess200Body]]
64 40 : [:map [:status [:= 404]] [:body ScoreboardResponseError404Body]]
65 40 : [:map [:status [:= 400]] [:body ScoreboardResponseError400Body]]])
|