1use serde::{Deserialize, Serialize};
4use std::fmt;
5
6#[derive(Clone, Default, PartialEq, Eq, Debug, Serialize, Deserialize)]
8#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
9#[cfg_attr(
10 feature = "sqlx",
11 sqlx(type_name = "subgroup_verdict", rename_all = "snake_case")
12)]
13#[serde(rename_all = "snake_case")]
14pub enum SubgroupVerdict {
15 #[default]
17 Ok,
18 RuntimeError,
20 TimeLimitExceeded,
22 MemoryLimitExceeded,
24 SecurityError,
26 WrongAnswer,
28 PresentationError,
30 Skipped,
32 Testing,
34}
35
36impl fmt::Display for SubgroupVerdict {
37 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
38 let converted = match self {
39 Self::Ok => "Ok",
40 Self::RuntimeError => "RuntimeError",
41 Self::TimeLimitExceeded => "TimeLimitExceeded",
42 Self::MemoryLimitExceeded => "MemoryLimitExceeded",
43 Self::SecurityError => "SecurityError",
44 Self::WrongAnswer => "WrongAnswer",
45 Self::PresentationError => "PresentationError",
46 Self::Skipped => "Skipped",
47 Self::Testing => "Testing",
48 };
49 write!(f, "{converted}")
50 }
51}
52
53impl std::error::Error for SubgroupVerdict {}
54
55#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
57#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
58#[cfg_attr(
59 feature = "sqlx",
60 sqlx(type_name = "total_verdict", rename_all = "snake_case")
61)]
62#[serde(rename_all = "snake_case")]
63pub enum TotalVerdict {
64 Ok,
66 PartialSolution,
68 Pending,
70 Compiling,
72 CompilationError,
74 Testing,
76 InvalidProblem,
78 InvalidRequest,
80 Bug,
82}
83
84impl fmt::Display for TotalVerdict {
85 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
86 let converted = match self {
87 Self::Ok => "Ok",
88 Self::PartialSolution => "PartialSolution",
89 Self::Pending => "Pending",
90 Self::Compiling => "Compiling",
91 Self::CompilationError => "CompilationError",
92 Self::Testing => "Testing",
93 Self::InvalidProblem => "InvalidProblem",
94 Self::InvalidRequest => "InvalidRequest",
95 Self::Bug => "Bug",
96 };
97 write!(f, "{converted}")
98 }
99}
100
101impl std::error::Error for TotalVerdict {}