use crate::model::{enums, shared, types};
use serde::{Deserialize, Serialize};
#[derive(Debug, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Allocations {
pub results: Vec<Allocation>,
pub has_more: bool,
}
#[derive(Debug, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Allocation {
pub id: types::UUID,
pub resource_type_id: ResourceType,
pub assignment_type_id: enums::AssignmentType,
pub start: types::Date,
pub end: types::Date,
pub unit: Unit,
pub hours_per_day: Option<i64>,
pub hours_per_week: Option<i64>,
pub hours_per_month: Option<i64>,
pub hours_per_allocation: Option<i64>,
pub hours_ratio_of_capacity: Option<f64>,
pub allocate_on_time_off_days: bool,
pub total_hours: i64,
pub is_billable: bool,
pub notes: String,
pub read_only: bool,
pub entity: Entity,
pub created_at: types::Timestamp,
pub member: Option<shared::Entity>,
pub placeholder: Option<shared::Entity>,
pub project: Option<shared::Project>,
pub role: Option<shared::Entity>,
pub task: Option<shared::Entity>,
pub time_off_type: Option<shared::Entity>,
}
#[derive(PartialEq, Deserialize, Serialize, Debug)]
#[serde(rename_all = "snake_case")]
pub enum ResourceType {
Member,
Placeholder,
}
#[derive(PartialEq, Deserialize, Serialize, Debug)]
#[serde(rename_all = "snake_case")]
pub enum Unit {
Day,
Week,
Month,
Allocation,
RatioOfCapacity,
}
#[derive(PartialEq, Deserialize, Serialize, Debug)]
#[serde(rename_all = "snake_case")]
pub enum Entity {
Allocation,
TimeEntry,
Holiday,
}
#[cfg(test)]
mod tests;