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