jira_api_v2/models/
time_tracking_configuration.rs

1/*
2 * The Jira Cloud platform REST API
3 *
4 * Jira Cloud platform REST API documentation
5 *
6 * The version of the OpenAPI document: 1001.0.0-SNAPSHOT
7 * Contact: ecosystem@atlassian.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// TimeTrackingConfiguration : Details of the time tracking configuration.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct TimeTrackingConfiguration {
17    /// The number of hours in a working day.
18    #[serde(rename = "workingHoursPerDay")]
19    pub working_hours_per_day: f64,
20    /// The number of days in a working week.
21    #[serde(rename = "workingDaysPerWeek")]
22    pub working_days_per_week: f64,
23    /// The format that will appear on an issue's *Time Spent* field.
24    #[serde(rename = "timeFormat")]
25    pub time_format: TimeFormat,
26    /// The default unit of time applied to logged time.
27    #[serde(rename = "defaultUnit")]
28    pub default_unit: DefaultUnit,
29}
30
31impl TimeTrackingConfiguration {
32    /// Details of the time tracking configuration.
33    pub fn new(working_hours_per_day: f64, working_days_per_week: f64, time_format: TimeFormat, default_unit: DefaultUnit) -> TimeTrackingConfiguration {
34        TimeTrackingConfiguration {
35            working_hours_per_day,
36            working_days_per_week,
37            time_format,
38            default_unit,
39        }
40    }
41}
42/// The format that will appear on an issue's *Time Spent* field.
43#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
44pub enum TimeFormat {
45    #[serde(rename = "pretty")]
46    Pretty,
47    #[serde(rename = "days")]
48    Days,
49    #[serde(rename = "hours")]
50    Hours,
51}
52
53impl Default for TimeFormat {
54    fn default() -> TimeFormat {
55        Self::Pretty
56    }
57}
58/// The default unit of time applied to logged time.
59#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
60pub enum DefaultUnit {
61    #[serde(rename = "minute")]
62    Minute,
63    #[serde(rename = "hour")]
64    Hour,
65    #[serde(rename = "day")]
66    Day,
67    #[serde(rename = "week")]
68    Week,
69}
70
71impl Default for DefaultUnit {
72    fn default() -> DefaultUnit {
73        Self::Minute
74    }
75}
76