1use crate::model::{enums, shared, types};
6use serde::{Deserialize, Serialize};
7
8#[derive(PartialEq, Deserialize, Serialize, Debug)]
10#[serde(rename_all = "camelCase")]
11pub struct Projects {
12 pub results: Vec<Project>,
13 pub has_more: bool,
14}
15
16#[derive(PartialEq, Deserialize, Serialize, Debug)]
18#[serde(rename_all = "camelCase")]
19pub struct Project {
20 pub id: types::UUID,
21 pub key: types::Slug,
22 pub name: String,
23 pub notes: String,
24 pub status_id: enums::Status,
25 pub start: Option<types::Date>,
26 pub end: Option<types::Date>,
27 pub code: String,
28 pub po_number: String,
29 pub billing_type_id: BillingType,
30 pub is_billable: bool,
31 pub currency: String,
32 pub revenue_recognition_method: Option<RevenueRecognitionMethod>,
33 pub fixed_fee: Option<i64>,
34 pub fixed_recurring_fee: Option<i64>,
35 pub fixed_recurring_start: Option<types::Date>,
36 pub fixed_recurring_end: Option<types::Date>,
37 pub use_roles: bool,
38 pub use_budget: bool,
39 pub budget_mode: Option<BudgetMode>,
40 pub use_monthly_budget: bool,
41 pub monthly_budget_mode: Option<MonthlyBudgetMode>,
42 pub cap_max_member_hours_per_day: bool,
43 pub max_member_hours_per_day: Option<i32>,
44 pub cap_max_member_hours_per_week: bool,
45 pub max_member_hours_per_week: Option<i32>,
46 pub cap_max_member_hours_per_month: bool,
47 pub max_member_hours_per_month: Option<i32>,
48 pub requires_notes: bool,
49 pub requires_tasks: bool,
50 pub record_status_id: RecordStatus,
51 pub is_productive: Option<bool>,
52 pub lock_time_and_expenses: bool,
53 pub track_time_to_assigned_roles: bool,
54 pub cloud_folder_url: String,
55 pub created_at: types::Timestamp,
56 pub completed_on: Option<types::Date>,
57 pub client: shared::Entity,
58 pub practice: shared::Entity,
59 pub project_type: shared::Entity,
60 pub tags: Vec<shared::Entity>,
61 pub sales_representative: Option<shared::Entity>,
62 pub business_unit: Option<shared::Entity>,
63 pub project_group: Option<shared::Entity>,
64 pub budget: Option<Budget>,
65 pub monthly_budget: Option<MonthlyBudget>,
66}
67
68#[derive(PartialEq, Deserialize, Serialize, Debug)]
69#[serde(rename_all = "camelCase")]
70pub struct Budget {
71 pub revenue: i64,
72 pub services_revenue: i64,
73 pub other_revenue: i64,
74 pub billable_expenses: i64,
75 pub non_billable_expenses: i64,
76 pub billable_hours: i64,
77 pub non_billable_hours: i64,
78}
79
80#[derive(PartialEq, Deserialize, Serialize, Debug)]
81#[serde(rename_all = "camelCase")]
82pub struct MonthlyBudget {
83 pub revenue: i64,
84 pub services_revenue: i64,
85 pub other_revenue: i64,
86 pub billable_expenses: i64,
87 pub non_billable_expenses: i64,
88 pub billable_hours: i64,
89 pub non_billable_hours: i64,
90}
91
92#[derive(PartialEq, Deserialize, Serialize, Debug)]
94#[serde(rename_all = "snake_case")]
95pub enum BillingType {
96 #[serde(rename = "tm")]
97 TimeAndMaterials,
98 Fixed,
99 FixedRecurring,
100 NonBillable,
101}
102
103#[derive(PartialEq, Deserialize, Serialize, Debug)]
104#[serde(rename_all = "snake_case")]
105pub enum RevenueRecognitionMethod {
106 Invoiced,
107 Manual,
108}
109
110#[derive(PartialEq, Deserialize, Serialize, Debug)]
111#[serde(rename_all = "snake_case")]
112pub enum BudgetMode {
113 Summary,
114 Detailed,
115 Aggregated,
116}
117
118#[derive(PartialEq, Deserialize, Serialize, Debug)]
119#[serde(rename_all = "snake_case")]
120pub enum MonthlyBudgetMode {
121 Summary,
122 Detailed,
123}
124
125#[derive(PartialEq, Deserialize, Serialize, Debug)]
126#[serde(rename_all = "snake_case")]
127pub enum RecordStatus {
128 Active,
129 Archived,
130}
131
132#[cfg(test)]
133mod tests;