imferno_core/mxf/
codes.rs1use crate::diagnostics::codes::ValidationCode;
4use crate::diagnostics::{Category, Severity};
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq, strum::EnumIter)]
8pub enum St377_1_2011 {
9 NotMxf,
11 ParseError,
13 NoEssenceContainers,
15 Op1a,
17}
18
19impl ValidationCode for St377_1_2011 {
20 fn code(&self) -> &'static str {
21 match self {
22 Self::NotMxf => "ST377-1:2011:5/NotMxf",
23 Self::ParseError => "ST377-1:2011:5/ParseError",
24 Self::NoEssenceContainers => "ST377-1:2011:11/NoEssenceContainers",
25 Self::Op1a => "ST377-1:2011:7/OP1a",
26 }
27 }
28 fn description(&self) -> &'static str {
29 match self {
30 Self::NotMxf => "File is not a valid MXF container.",
31 Self::ParseError => "MXF file could not be parsed; it may be truncated or corrupt.",
32 Self::NoEssenceContainers => "MXF file contains no essence containers.",
33 Self::Op1a => "MXF operational pattern must be OP1a for IMF packages.",
34 }
35 }
36 fn default_severity(&self) -> Severity {
37 match self {
38 Self::NotMxf | Self::ParseError | Self::NoEssenceContainers => Severity::Warning,
39 Self::Op1a => Severity::Error,
40 }
41 }
42 fn category(&self) -> Category {
43 match self {
44 Self::NotMxf | Self::ParseError => Category::Asset,
45 Self::NoEssenceContainers | Self::Op1a => Category::Encoding,
46 }
47 }
48}
49
50impl St377_1_2011 {
51 pub const ALL: &'static [Self] = &[
52 Self::NotMxf,
53 Self::ParseError,
54 Self::NoEssenceContainers,
55 Self::Op1a,
56 ];
57}
58
59impl From<St377_1_2011> for String {
60 fn from(c: St377_1_2011) -> String {
61 c.code().to_string()
62 }
63}