pub struct InternalControl {Show 22 fields
pub control_id: String,
pub control_name: String,
pub control_type: ControlType,
pub objective: String,
pub frequency: ControlFrequency,
pub owner_role: UserPersona,
pub risk_level: RiskLevel,
pub description: String,
pub is_key_control: bool,
pub sox_assertion: SoxAssertion,
pub coso_component: CosoComponent,
pub coso_principles: Vec<CosoPrinciple>,
pub control_scope: ControlScope,
pub maturity_level: CosoMaturityLevel,
pub owner_employee_id: Option<String>,
pub owner_name: String,
pub test_count: u32,
pub last_tested_date: Option<NaiveDate>,
pub test_result: TestResult,
pub effectiveness: ControlEffectiveness,
pub mitigates_risk_ids: Vec<String>,
pub covers_account_classes: Vec<String>,
}Expand description
Internal control definition.
Fields§
§control_id: StringUnique control identifier (e.g., “C001”, “C010”)
control_name: StringControl name/title
control_type: ControlTypeType of control (Preventive, Detective, Monitoring)
objective: StringControl objective description
frequency: ControlFrequencyHow often the control is performed
owner_role: UserPersonaRole responsible for executing/owning the control
risk_level: RiskLevelRisk level associated with control failure
description: StringDetailed description of the control procedure
is_key_control: boolWhether this is a SOX 404 key control
sox_assertion: SoxAssertionSOX assertion this control addresses
coso_component: CosoComponentCOSO 2013 component this control maps to
coso_principles: Vec<CosoPrinciple>COSO 2013 principles this control addresses
control_scope: ControlScopeControl scope (entity-level vs transaction-level)
maturity_level: CosoMaturityLevelControl maturity level
owner_employee_id: Option<String>Employee ID of the control owner (resolved from owner_role at generation time)
owner_name: StringDisplay name of the control owner
test_count: u32Number of times this control has been tested
last_tested_date: Option<NaiveDate>Date of the most recent test
test_result: TestResultResult of the most recent test
effectiveness: ControlEffectivenessDerived effectiveness rating (from maturity_level + test_result)
mitigates_risk_ids: Vec<String>IDs of risks this control mitigates (populated at generation time)
covers_account_classes: Vec<String>Account classes this control covers (derived from sox_assertion)
Implementations§
Source§impl InternalControl
impl InternalControl
Sourcepub fn new(
control_id: impl Into<String>,
control_name: impl Into<String>,
control_type: ControlType,
objective: impl Into<String>,
) -> Self
pub fn new( control_id: impl Into<String>, control_name: impl Into<String>, control_type: ControlType, objective: impl Into<String>, ) -> Self
Create a new internal control.
Sourcepub fn with_frequency(self, frequency: ControlFrequency) -> Self
pub fn with_frequency(self, frequency: ControlFrequency) -> Self
Builder method to set frequency.
Sourcepub fn with_owner(self, owner: UserPersona) -> Self
pub fn with_owner(self, owner: UserPersona) -> Self
Builder method to set owner role.
Sourcepub fn with_risk_level(self, level: RiskLevel) -> Self
pub fn with_risk_level(self, level: RiskLevel) -> Self
Builder method to set risk level.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Builder method to set description.
Sourcepub fn as_key_control(self) -> Self
pub fn as_key_control(self) -> Self
Builder method to mark as key control.
Sourcepub fn with_assertion(self, assertion: SoxAssertion) -> Self
pub fn with_assertion(self, assertion: SoxAssertion) -> Self
Builder method to set SOX assertion.
Sourcepub fn with_coso_component(self, component: CosoComponent) -> Self
pub fn with_coso_component(self, component: CosoComponent) -> Self
Builder method to set COSO component.
Sourcepub fn with_coso_principles(self, principles: Vec<CosoPrinciple>) -> Self
pub fn with_coso_principles(self, principles: Vec<CosoPrinciple>) -> Self
Builder method to set COSO principles.
Sourcepub fn with_control_scope(self, scope: ControlScope) -> Self
pub fn with_control_scope(self, scope: ControlScope) -> Self
Builder method to set control scope.
Sourcepub fn with_maturity_level(self, level: CosoMaturityLevel) -> Self
pub fn with_maturity_level(self, level: CosoMaturityLevel) -> Self
Builder method to set maturity level.
Sourcepub fn with_owner_employee(
self,
employee_id: impl Into<String>,
name: impl Into<String>,
) -> Self
pub fn with_owner_employee( self, employee_id: impl Into<String>, name: impl Into<String>, ) -> Self
Builder method to set owner employee ID and name.
Sourcepub fn with_test_history(
self,
test_count: u32,
last_tested_date: Option<NaiveDate>,
test_result: TestResult,
) -> Self
pub fn with_test_history( self, test_count: u32, last_tested_date: Option<NaiveDate>, test_result: TestResult, ) -> Self
Builder method to set test history.
Sourcepub fn with_effectiveness(self, effectiveness: ControlEffectiveness) -> Self
pub fn with_effectiveness(self, effectiveness: ControlEffectiveness) -> Self
Builder method to set effectiveness.
Sourcepub fn with_mitigates_risk_ids(self, risk_ids: Vec<String>) -> Self
pub fn with_mitigates_risk_ids(self, risk_ids: Vec<String>) -> Self
Builder method to set mitigated risk IDs.
Sourcepub fn with_covers_account_classes(self, classes: Vec<String>) -> Self
pub fn with_covers_account_classes(self, classes: Vec<String>) -> Self
Builder method to set covered account classes.
Sourcepub fn derive_from_maturity(&mut self, assessed_date: NaiveDate)
pub fn derive_from_maturity(&mut self, assessed_date: NaiveDate)
Derive test history and effectiveness from the current maturity_level.
Call this after setting maturity_level to populate test_count,
last_tested_date, test_result, and effectiveness.
- Maturity >= 4 (Managed/Optimized): tested multiple times, Pass, Effective
- Maturity == 3 (Defined): tested once, Partial, PartiallyEffective
- Maturity <= 2 (NonExistent/AdHoc/Repeatable): not tested
assessed_date is the reference date from which last_tested_date is
back-computed: assessed_date - 30 * (5 - maturity_level) days.
Sourcepub fn derive_account_classes(&mut self)
pub fn derive_account_classes(&mut self)
Derive covers_account_classes from sox_assertion.
Maps SOX assertions to the account classes they cover:
- Existence -> Assets
- Completeness -> Revenue, Liabilities
- Valuation -> Assets, Liabilities, Equity, Revenue, Expenses
- RightsAndObligations -> Assets, Liabilities
- PresentationAndDisclosure -> Revenue, Equity
Sourcepub fn standard_controls() -> Vec<Self>
pub fn standard_controls() -> Vec<Self>
Generate standard controls for a typical organization.
Includes both transaction-level controls (C001-C060) and entity-level controls (C070-C081) with full COSO 2013 mappings.
Trait Implementations§
Source§impl Clone for InternalControl
impl Clone for InternalControl
Source§fn clone(&self) -> InternalControl
fn clone(&self) -> InternalControl
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InternalControl
impl Debug for InternalControl
Source§impl<'de> Deserialize<'de> for InternalControl
impl<'de> Deserialize<'de> for InternalControl
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for InternalControl
impl RefUnwindSafe for InternalControl
impl Send for InternalControl
impl Sync for InternalControl
impl Unpin for InternalControl
impl UnsafeUnpin for InternalControl
impl UnwindSafe for InternalControl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.