quickbooks_types/models/
employee.rs

1use chrono::NaiveDate;
2use serde::{Deserialize, Serialize};
3use serde_with::skip_serializing_none;
4
5use super::common::{Addr, Email, MetaData, PhoneNumber};
6#[cfg(feature = "builder")]
7use crate::error::QBTypeError;
8use crate::{QBCreatable, QBFullUpdatable, QBItem};
9
10#[skip_serializing_none]
11#[derive(Clone, Debug, Deserialize, PartialEq, Serialize, Default)]
12#[serde(rename_all = "PascalCase", default)]
13#[cfg_attr(
14    feature = "builder",
15    derive(Builder),
16    builder(default, build_fn(error = "QBTypeError"), setter(into, strip_option))
17)]
18/// Employee
19///
20/// Represents an internal staff member or contractor tracked for payroll, time entry,
21/// or billable activities in `QuickBooks` Online.
22///
23/// API reference:
24/// <https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/employee>
25pub struct Employee {
26    /// The unique ID of the entity
27    pub id: Option<String>,
28    /// The unique sync token of the entity, used for concurrency control
29    pub sync_token: Option<String>,
30    /// Metadata about the entity
31    #[serde(skip_serializing)]
32    pub meta_data: Option<MetaData>,
33    /// Primary address information for the employee
34    pub primary_addr: Option<Addr>,
35    /// Primary email address for the employee
36    pub primary_email_addr: Option<Email>,
37    /// Display name of the employee
38    pub display_name: Option<String>,
39    /// Title or position of the employee
40    pub title: Option<String>,
41    /// Indicates if the employee's time can be billed to customers
42    pub billable_time: Option<bool>,
43    /// The employee's first name
44    pub given_name: Option<String>,
45    /// The employee's birth date
46    pub birth_date: Option<NaiveDate>,
47    /// The employee's middle name
48    pub middle_name: Option<String>,
49    /// The employee's Social Security Number
50    pub ssn: Option<String>,
51    /// Primary phone number for the employee
52    pub primary_phone: Option<PhoneNumber>,
53    /// Indicates if the employee is active
54    pub active: Option<bool>,
55    /// Date when the employee was released from employment
56    pub released_date: Option<NaiveDate>,
57    /// The employee's cost rate per hour
58    pub cost_rate: Option<f64>,
59    /// Mobile phone number for the employee
60    pub mobile: Option<PhoneNumber>,
61    /// The employee's gender
62    pub gender: Option<String>,
63    /// Date when the employee was hired
64    pub hired_date: Option<NaiveDate>,
65    /// The rate at which the employee's time is billed to customers
66    pub bill_rate: Option<f64>,
67    /// Indicates if the employee is an organization rather than an individual
68    pub organization: Option<bool>,
69    /// The employee's name suffix (e.g. Jr, Sr, III)
70    pub suffix: Option<String>,
71    /// The employee's last name
72    pub family_name: Option<String>,
73    /// The employee's name as it should appear on checks
74    pub print_on_check_name: Option<String>,
75    /// The employee's identification number within the company
76    pub employee_number: Option<String>,
77    /// Identity provider pseudonym for the employee
78    #[serde(rename = "V4IDPseudonym")]
79    pub v4id_pseudonym: Option<String>,
80}
81
82impl QBCreatable for Employee {
83    fn can_create(&self) -> bool {
84        self.given_name.is_some() || self.family_name.is_some()
85    }
86}
87
88impl QBFullUpdatable for Employee {
89    fn can_full_update(&self) -> bool {
90        self.has_read()
91    }
92}