1use allow_core::StructuralIdentity;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4pub struct DiffPostureSummary {
5 pub current_failures: usize,
6 pub new_findings: usize,
7 pub removed_findings: usize,
8 pub policy_failures: usize,
9 pub policy_review_items: usize,
10 pub policy_improvements: usize,
11}
12
13#[derive(Debug, Clone, Copy)]
14pub struct DiffFindingChange<'a> {
15 pub change: &'a str,
16 pub key: &'a str,
17 pub kind: &'a str,
18 pub family: Option<&'a str>,
19 pub path: &'a str,
20 pub line: Option<u32>,
21 pub column: Option<u32>,
22 pub source_package: Option<&'a str>,
23 pub identity: Option<&'a StructuralIdentity>,
24}
25
26#[derive(Debug, Clone, Copy)]
27pub struct DiffPolicyChange<'a> {
28 pub severity: &'a str,
29 pub allow_id: &'a str,
30 pub kind: &'a str,
31 pub message: &'a str,
32 pub exception_identity: Option<DiffExceptionIdentityChange<'a>>,
33 pub selector_identity: Option<DiffSelectorIdentityChange<'a>>,
34 pub selector_precision: Option<DiffSelectorPrecisionChange<'a>>,
35 pub scope: Option<DiffScopeChange<'a>>,
36 pub occurrence_limit: Option<DiffOccurrenceLimitChange>,
37 pub lifecycle: Option<DiffLifecycleChange<'a>>,
38 pub evidence: Option<DiffEvidenceChange<'a>>,
39 pub metadata: Option<DiffMetadataChange<'a>>,
40 pub requirement: Option<DiffRequirementChange<'a>>,
41 pub policy_status: Option<DiffPolicyStatusChange<'a>>,
42}
43
44#[derive(Debug, Clone, Copy)]
45pub struct DiffExceptionIdentityChange<'a> {
46 pub field: &'a str,
47 pub before: Option<&'a str>,
48 pub after: Option<&'a str>,
49}
50
51#[derive(Debug, Clone, Copy)]
52pub struct DiffSelectorIdentityChange<'a> {
53 pub changed_fields: &'a [&'a str],
54}
55
56#[derive(Debug, Clone, Copy)]
57pub struct DiffSelectorPrecisionChange<'a> {
58 pub before: u32,
59 pub after: u32,
60 pub removed_fields: &'a [&'a str],
61 pub added_fields: &'a [&'a str],
62}
63
64#[derive(Debug, Clone, Copy)]
65pub struct DiffScopeChange<'a> {
66 pub field: &'a str,
67 pub before: Option<&'a str>,
68 pub after: Option<&'a str>,
69}
70
71#[derive(Debug, Clone, Copy)]
72pub struct DiffOccurrenceLimitChange {
73 pub before: Option<u32>,
74 pub after: Option<u32>,
75}
76
77#[derive(Debug, Clone, Copy)]
78pub struct DiffLifecycleChange<'a> {
79 pub field: &'a str,
80 pub before: Option<&'a str>,
81 pub after: Option<&'a str>,
82}
83
84#[derive(Debug, Clone, Copy)]
85pub struct DiffEvidenceChange<'a> {
86 pub field: &'a str,
87 pub removed: &'a [String],
88 pub added: &'a [String],
89}
90
91#[derive(Debug, Clone, Copy)]
92pub struct DiffMetadataChange<'a> {
93 pub field: &'a str,
94 pub before: Option<&'a str>,
95 pub after: Option<&'a str>,
96}
97
98#[derive(Debug, Clone, Copy)]
99pub struct DiffRequirementChange<'a> {
100 pub field: &'a str,
101 pub before: bool,
102 pub after: bool,
103}
104
105#[derive(Debug, Clone, Copy)]
106pub struct DiffPolicyStatusChange<'a> {
107 pub before: Option<&'a str>,
108 pub after: Option<&'a str>,
109}
110
111#[derive(Debug, Clone, Copy)]
112pub struct DiffReport<'a> {
113 pub net_posture: &'a str,
114 pub reviewer_action: &'a str,
115 pub summary: DiffPostureSummary,
116 pub finding_changes: &'a [DiffFindingChange<'a>],
117 pub policy_changes: &'a [DiffPolicyChange<'a>],
118}