datasynth_core/models/audit/component_audit.rs
1//! ISA 600 Group Audit — component auditor models.
2//!
3//! Supports simulation of group audit engagements following ISA 600 (Special
4//! Considerations — Audits of Group Financial Statements), including:
5//!
6//! - Component auditor assignment and competence assessment
7//! - Group audit planning and materiality allocation
8//! - Component instructions issued by the group engagement team
9//! - Component auditor reporting back to the group
10
11use chrono::NaiveDate;
12use rust_decimal::Decimal;
13use serde::{Deserialize, Serialize};
14
15/// A component auditor firm assigned to one or more group entities.
16#[derive(Debug, Clone, Serialize, Deserialize)]
17pub struct ComponentAuditor {
18 /// Unique identifier.
19 pub id: String,
20 /// Audit firm name (e.g., "Audit Firm DE").
21 pub firm_name: String,
22 /// Jurisdiction / country code the firm operates in.
23 pub jurisdiction: String,
24 /// Whether independence has been confirmed by the group engagement team.
25 pub independence_confirmed: bool,
26 /// Group engagement team's assessment of competence.
27 pub competence_assessment: CompetenceLevel,
28 /// Entity codes this component auditor is responsible for.
29 pub assigned_entities: Vec<String>,
30}
31
32/// Competence assessment of a component auditor by the group team.
33#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
34pub enum CompetenceLevel {
35 /// Competence is satisfactory — no additional supervision required.
36 Satisfactory,
37 /// Satisfactory with conditions — additional supervision or procedures required.
38 RequiresSupervision,
39 /// Unsatisfactory — alternative arrangements must be made.
40 Unsatisfactory,
41}
42
43/// Overall group audit plan covering all components.
44#[derive(Debug, Clone, Serialize, Deserialize)]
45pub struct GroupAuditPlan {
46 /// Reference to the parent audit engagement.
47 pub engagement_id: String,
48 /// Group-level materiality (applied to group financial statements).
49 #[serde(with = "rust_decimal::serde::str")]
50 pub group_materiality: Decimal,
51 /// Materiality allocation per component entity.
52 pub component_allocations: Vec<ComponentMaterialityAllocation>,
53 /// Aggregation risk level (risk that uncorrected misstatements in components
54 /// would in aggregate exceed group materiality).
55 pub aggregation_risk: GroupRiskLevel,
56 /// Entity codes identified as significant components.
57 pub significant_components: Vec<String>,
58 /// Consolidation-level audit procedures performed by the group team.
59 pub consolidation_audit_procedures: Vec<String>,
60}
61
62/// Aggregation risk level for group audits (ISA 600).
63///
64/// Named `GroupRiskLevel` to avoid conflict with the engagement-level
65/// `RiskLevel` enum used in ISA 315/330 risk assessments.
66#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
67pub enum GroupRiskLevel {
68 Low,
69 Medium,
70 High,
71}
72
73/// Materiality allocation for a single component entity.
74#[derive(Debug, Clone, Serialize, Deserialize)]
75pub struct ComponentMaterialityAllocation {
76 /// Entity code this allocation applies to.
77 pub entity_code: String,
78 /// Component materiality threshold (lower than group materiality).
79 #[serde(with = "rust_decimal::serde::str")]
80 pub component_materiality: Decimal,
81 /// Clearly-trivial threshold (items below this need not be aggregated).
82 #[serde(with = "rust_decimal::serde::str")]
83 pub clearly_trivial: Decimal,
84 /// Basis used to allocate materiality.
85 pub allocation_basis: AllocationBasis,
86}
87
88/// Basis for allocating group materiality to a component.
89#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
90pub enum AllocationBasis {
91 /// Proportional to component's share of group revenue.
92 RevenueProportional,
93 /// Proportional to component's share of group total assets.
94 AssetProportional,
95 /// Based on assessed risk rather than financial size.
96 RiskBased,
97}
98
99/// Scope of work required from a component auditor.
100#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
101#[serde(tag = "type")]
102pub enum ComponentScope {
103 /// Full audit of the component financial statements.
104 FullScope,
105 /// Audit of specific account areas only.
106 SpecificScope {
107 /// Account areas subject to audit procedures.
108 account_areas: Vec<String>,
109 },
110 /// Limited agreed-upon procedures.
111 LimitedProcedures,
112 /// Analytical procedures only — typically for non-significant components.
113 AnalyticalOnly,
114}
115
116/// Instruction issued by the group engagement team to a component auditor.
117#[derive(Debug, Clone, Serialize, Deserialize)]
118pub struct ComponentInstruction {
119 /// Unique identifier.
120 pub id: String,
121 /// ID of the component auditor receiving the instruction.
122 pub component_auditor_id: String,
123 /// Entity code this instruction relates to.
124 pub entity_code: String,
125 /// Scope of work required.
126 pub scope: ComponentScope,
127 /// Materiality allocated for this instruction (from GroupAuditPlan).
128 #[serde(with = "rust_decimal::serde::str")]
129 pub materiality_allocated: Decimal,
130 /// Deadline by which the component auditor must report back.
131 pub reporting_deadline: NaiveDate,
132 /// Specific audit procedures the component auditor is required to perform.
133 pub specific_procedures: Vec<String>,
134 /// Account areas or risk areas the group team wishes to focus on.
135 pub areas_of_focus: Vec<String>,
136}
137
138/// Report returned by a component auditor to the group engagement team.
139#[derive(Debug, Clone, Serialize, Deserialize)]
140pub struct ComponentAuditorReport {
141 /// Unique identifier.
142 pub id: String,
143 /// ID of the instruction this report responds to.
144 pub instruction_id: String,
145 /// ID of the component auditor submitting the report.
146 pub component_auditor_id: String,
147 /// Entity code this report covers.
148 pub entity_code: String,
149 /// Misstatements identified during the component audit.
150 pub misstatements_identified: Vec<Misstatement>,
151 /// Any limitations on the scope of work performed.
152 pub scope_limitations: Vec<String>,
153 /// Findings significant enough to communicate to the group team.
154 pub significant_findings: Vec<String>,
155 /// Overall conclusion of the component auditor (plain text).
156 pub conclusion: String,
157}
158
159/// A misstatement identified by a component auditor.
160#[derive(Debug, Clone, Serialize, Deserialize)]
161pub struct Misstatement {
162 /// Description of the misstatement.
163 pub description: String,
164 /// Monetary amount of the misstatement.
165 #[serde(with = "rust_decimal::serde::str")]
166 pub amount: Decimal,
167 /// Classification of the misstatement.
168 pub classification: MisstatementType,
169 /// Account area or financial statement line where the misstatement was found.
170 pub account_area: String,
171 /// Whether the misstatement was corrected by management.
172 pub corrected: bool,
173}
174
175/// Classification of an audit misstatement.
176#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
177pub enum MisstatementType {
178 /// A specific misstatement that can be precisely measured.
179 Factual,
180 /// A misstatement arising from a difference in accounting judgment.
181 Judgmental,
182 /// An extrapolation from a sample to the full population.
183 Projected,
184}
185
186/// The full output of group audit / component audit generation.
187#[derive(Debug, Clone, Default)]
188pub struct ComponentAuditSnapshot {
189 /// One auditor record per jurisdiction.
190 pub component_auditors: Vec<ComponentAuditor>,
191 /// The overall group audit plan.
192 pub group_audit_plan: Option<GroupAuditPlan>,
193 /// One instruction per entity.
194 pub component_instructions: Vec<ComponentInstruction>,
195 /// One report per entity.
196 pub component_reports: Vec<ComponentAuditorReport>,
197}