use ifc_model::EntityId;
use super::procedure::ProcedureDraft;
use super::timing::TaskTimeDraft;
use super::{
DateTimeValue, EventDraft, EventTimeDraft, RecurrenceDraft, TaskDraft, WorkControlDraft,
};
impl<'a> TaskDraft<'a> {
#[must_use]
pub fn new(global_id: &'a str) -> Self {
Self {
global_id,
..Self::default()
}
}
#[must_use]
pub fn name(mut self, value: &'a str) -> Self {
self.name = Some(value);
self
}
#[must_use]
pub fn description(mut self, value: &'a str) -> Self {
self.description = Some(value);
self
}
#[must_use]
pub fn identification(mut self, value: &'a str) -> Self {
self.identification = Some(value);
self
}
#[must_use]
pub fn long_description(mut self, value: &'a str) -> Self {
self.long_description = Some(value);
self
}
#[must_use]
pub fn status(mut self, value: &'a str) -> Self {
self.status = Some(value);
self
}
#[must_use]
pub fn work_method(mut self, value: &'a str) -> Self {
self.work_method = Some(value);
self
}
#[must_use]
pub fn is_milestone(mut self, value: bool) -> Self {
self.is_milestone = value;
self
}
#[must_use]
pub fn priority(mut self, value: i64) -> Self {
self.priority = Some(value);
self
}
#[must_use]
pub fn task_time(mut self, value: EntityId) -> Self {
self.task_time = Some(value);
self
}
#[must_use]
pub fn predefined_type(mut self, value: &'a str) -> Self {
self.predefined_type = Some(value);
self
}
}
impl<'a> WorkControlDraft<'a> {
#[must_use]
pub fn new(
global_id: &'a str,
creation_date: impl Into<DateTimeValue<'a>>,
start_time: impl Into<DateTimeValue<'a>>,
) -> Self {
Self {
global_id,
creation_date: creation_date.into(),
start_time: start_time.into(),
..Self::default()
}
}
#[must_use]
pub fn name(mut self, value: &'a str) -> Self {
self.name = Some(value);
self
}
#[must_use]
pub fn description(mut self, value: &'a str) -> Self {
self.description = Some(value);
self
}
#[must_use]
pub fn identification(mut self, value: &'a str) -> Self {
self.identification = Some(value);
self
}
#[must_use]
pub fn purpose(mut self, value: &'a str) -> Self {
self.purpose = Some(value);
self
}
#[must_use]
pub fn duration(mut self, value: &'a str) -> Self {
self.duration = Some(value);
self
}
#[must_use]
pub fn total_float(mut self, value: &'a str) -> Self {
self.total_float = Some(value);
self
}
#[must_use]
pub fn finish_time(mut self, value: impl Into<DateTimeValue<'a>>) -> Self {
self.finish_time = Some(value.into());
self
}
#[must_use]
pub fn predefined_type(mut self, value: &'a str) -> Self {
self.predefined_type = Some(value);
self
}
}
impl<'a> EventDraft<'a> {
#[must_use]
pub fn new(global_id: &'a str) -> Self {
Self {
global_id,
..Self::default()
}
}
#[must_use]
pub fn name(mut self, value: &'a str) -> Self {
self.name = Some(value);
self
}
#[must_use]
pub fn object_type(mut self, value: &'a str) -> Self {
self.object_type = Some(value);
self
}
#[must_use]
pub fn identification(mut self, value: &'a str) -> Self {
self.identification = Some(value);
self
}
#[must_use]
pub fn long_description(mut self, value: &'a str) -> Self {
self.long_description = Some(value);
self
}
#[must_use]
pub fn predefined_type(mut self, value: &'a str) -> Self {
self.predefined_type = Some(value);
self
}
#[must_use]
pub fn trigger_type(mut self, value: &'a str) -> Self {
self.trigger_type = Some(value);
self
}
#[must_use]
pub fn user_defined_trigger_type(mut self, value: &'a str) -> Self {
self.user_defined_trigger_type = Some(value);
self
}
#[must_use]
pub fn occurence_time(mut self, value: EntityId) -> Self {
self.occurence_time = Some(value);
self
}
}
impl<'a> EventTimeDraft<'a> {
#[must_use]
pub fn new() -> Self {
Self::default()
}
#[must_use]
pub fn name(mut self, value: &'a str) -> Self {
self.name = Some(value);
self
}
#[must_use]
pub fn actual(mut self, value: &'a str) -> Self {
self.actual = Some(value);
self
}
#[must_use]
pub fn early(mut self, value: &'a str) -> Self {
self.early = Some(value);
self
}
#[must_use]
pub fn late(mut self, value: &'a str) -> Self {
self.late = Some(value);
self
}
#[must_use]
pub fn schedule(mut self, value: &'a str) -> Self {
self.schedule = Some(value);
self
}
}
impl<'a> RecurrenceDraft<'a> {
#[must_use]
pub fn new(recurrence_type: &'a str) -> Self {
Self {
recurrence_type,
..Self::default()
}
}
#[must_use]
pub fn days(mut self, value: Vec<i64>) -> Self {
self.days = value;
self
}
#[must_use]
pub fn weekdays(mut self, value: Vec<i64>) -> Self {
self.weekdays = value;
self
}
#[must_use]
pub fn months(mut self, value: Vec<i64>) -> Self {
self.months = value;
self
}
#[must_use]
pub fn position(mut self, value: i64) -> Self {
self.position = Some(value);
self
}
#[must_use]
pub fn interval(mut self, value: i64) -> Self {
self.interval = Some(value);
self
}
#[must_use]
pub fn occurrences(mut self, value: i64) -> Self {
self.occurrences = Some(value);
self
}
}
impl<'a> ProcedureDraft<'a> {
#[must_use]
pub fn new(global_id: &'a str) -> Self {
Self {
global_id,
..Self::default()
}
}
#[must_use]
pub fn name(mut self, value: &'a str) -> Self {
self.name = Some(value);
self
}
#[must_use]
pub fn description(mut self, value: &'a str) -> Self {
self.description = Some(value);
self
}
#[must_use]
pub fn object_type(mut self, value: &'a str) -> Self {
self.object_type = Some(value);
self
}
#[must_use]
pub fn identification(mut self, value: &'a str) -> Self {
self.identification = Some(value);
self
}
#[must_use]
pub fn long_description(mut self, value: &'a str) -> Self {
self.long_description = Some(value);
self
}
#[must_use]
pub fn predefined_type(mut self, value: &'a str) -> Self {
self.predefined_type = Some(value);
self
}
#[must_use]
pub fn user_defined_procedure_type(mut self, value: &'a str) -> Self {
self.user_defined_procedure_type = Some(value);
self
}
}
impl<'a> TaskTimeDraft<'a> {
#[must_use]
pub fn new() -> Self {
Self::default()
}
#[must_use]
pub fn name(mut self, value: &'a str) -> Self {
self.name = Some(value);
self
}
#[must_use]
pub fn duration_type(mut self, value: &'a str) -> Self {
self.duration_type = Some(value);
self
}
#[must_use]
pub fn schedule_duration(mut self, value: &'a str) -> Self {
self.schedule_duration = Some(value);
self
}
#[must_use]
pub fn schedule_start(mut self, value: &'a str) -> Self {
self.schedule_start = Some(value);
self
}
#[must_use]
pub fn schedule_finish(mut self, value: &'a str) -> Self {
self.schedule_finish = Some(value);
self
}
#[must_use]
pub fn actual_start(mut self, value: &'a str) -> Self {
self.actual_start = Some(value);
self
}
#[must_use]
pub fn actual_finish(mut self, value: &'a str) -> Self {
self.actual_finish = Some(value);
self
}
#[must_use]
pub fn is_critical(mut self, value: bool) -> Self {
self.is_critical = Some(value);
self
}
#[must_use]
pub fn completion(mut self, value: f64) -> Self {
self.completion = Some(value);
self
}
}