pub struct Employee {Show 32 fields
pub employee_id: String,
pub user_id: String,
pub display_name: String,
pub first_name: String,
pub last_name: String,
pub email: String,
pub persona: UserPersona,
pub job_level: JobLevel,
pub job_title: String,
pub department_id: Option<String>,
pub cost_center: Option<String>,
pub manager_id: Option<String>,
pub direct_reports: Vec<String>,
pub status: EmployeeStatus,
pub company_code: String,
pub working_hours: WorkingHoursPattern,
pub authorized_company_codes: Vec<String>,
pub authorized_cost_centers: Vec<String>,
pub approval_limit: Decimal,
pub can_approve_pr: bool,
pub can_approve_po: bool,
pub can_approve_invoice: bool,
pub can_approve_je: bool,
pub can_release_payment: bool,
pub system_roles: Vec<SystemRole>,
pub transaction_codes: Vec<TransactionCodeAuth>,
pub hire_date: Option<NaiveDate>,
pub termination_date: Option<NaiveDate>,
pub location: Option<String>,
pub is_shared_services: bool,
pub phone: Option<String>,
pub base_salary: Decimal,
}Expand description
Employee master data with organizational hierarchy.
Fields§
§employee_id: StringEmployee ID (e.g., “E-001234”)
user_id: StringUser ID (login name, links to User)
display_name: StringDisplay name
first_name: StringFirst name
last_name: StringLast name
email: StringEmail address
persona: UserPersonaPersona classification
job_level: JobLevelJob level
job_title: StringJob title
department_id: Option<String>Department ID
cost_center: Option<String>Cost center
manager_id: Option<String>Manager’s employee ID (for hierarchy)
direct_reports: Vec<String>Direct reports (employee IDs)
status: EmployeeStatusEmployment status
company_code: StringCompany code
working_hours: WorkingHoursPatternWorking hours pattern
Authorized company codes
Authorized cost centers
approval_limit: DecimalApproval limit (monetary threshold)
can_approve_pr: boolCan approve purchase requisitions
can_approve_po: boolCan approve purchase orders
can_approve_invoice: boolCan approve invoices
can_approve_je: boolCan approve journal entries
can_release_payment: boolCan release payments
system_roles: Vec<SystemRole>System roles
transaction_codes: Vec<TransactionCodeAuth>Authorized transaction codes
hire_date: Option<NaiveDate>Hire date
termination_date: Option<NaiveDate>Termination date (if applicable)
location: Option<String>Location / plant
Is this an intercompany employee (works for multiple entities)?
phone: Option<String>Phone number
base_salary: DecimalAnnual base salary in the company’s local currency.
Used by the payroll generator to compute monthly gross pay
(base_salary / 12) instead of a hardcoded default.
Implementations§
Source§impl Employee
impl Employee
Sourcepub fn new(
employee_id: impl Into<String>,
user_id: impl Into<String>,
first_name: impl Into<String>,
last_name: impl Into<String>,
company_code: impl Into<String>,
) -> Self
pub fn new( employee_id: impl Into<String>, user_id: impl Into<String>, first_name: impl Into<String>, last_name: impl Into<String>, company_code: impl Into<String>, ) -> Self
Create a new employee.
Sourcepub fn with_persona(self, persona: UserPersona) -> Self
pub fn with_persona(self, persona: UserPersona) -> Self
Set persona and adjust defaults accordingly.
Sourcepub fn with_job_level(self, level: JobLevel) -> Self
pub fn with_job_level(self, level: JobLevel) -> Self
Set job level.
Sourcepub fn with_job_title(self, title: impl Into<String>) -> Self
pub fn with_job_title(self, title: impl Into<String>) -> Self
Set job title.
Sourcepub fn with_manager(self, manager_id: impl Into<String>) -> Self
pub fn with_manager(self, manager_id: impl Into<String>) -> Self
Set manager.
Sourcepub fn with_department(self, department_id: impl Into<String>) -> Self
pub fn with_department(self, department_id: impl Into<String>) -> Self
Set department.
Sourcepub fn with_cost_center(self, cost_center: impl Into<String>) -> Self
pub fn with_cost_center(self, cost_center: impl Into<String>) -> Self
Set cost center.
Sourcepub fn with_approval_limit(self, limit: Decimal) -> Self
pub fn with_approval_limit(self, limit: Decimal) -> Self
Set approval limit.
Add authorized company code.
Sourcepub fn with_role(self, role: SystemRole) -> Self
pub fn with_role(self, role: SystemRole) -> Self
Add system role.
Sourcepub fn with_hire_date(self, date: NaiveDate) -> Self
pub fn with_hire_date(self, date: NaiveDate) -> Self
Set hire date.
Sourcepub fn add_direct_report(&mut self, employee_id: String)
pub fn add_direct_report(&mut self, employee_id: String)
Add a direct report.
Sourcepub fn can_approve_amount(&self, amount: Decimal) -> bool
pub fn can_approve_amount(&self, amount: Decimal) -> bool
Check if employee can approve an amount.
Sourcepub fn can_approve_in_company(&self, company_code: &str) -> bool
pub fn can_approve_in_company(&self, company_code: &str) -> bool
Check if employee can approve in a company code.
Sourcepub fn has_role(&self, role: &SystemRole) -> bool
pub fn has_role(&self, role: &SystemRole) -> bool
Check if employee has a specific role.
Sourcepub fn hierarchy_depth(&self) -> u8
pub fn hierarchy_depth(&self) -> u8
Get the depth in the org hierarchy (0 = top).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Employee
impl<'de> Deserialize<'de> for Employee
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 Employee
impl RefUnwindSafe for Employee
impl Send for Employee
impl Sync for Employee
impl Unpin for Employee
impl UnsafeUnpin for Employee
impl UnwindSafe for Employee
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.