Skip to main content

autogen_squareup/models/
timecard.rs

1/*
2 * Square
3 *
4 * Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.
5 *
6 * The version of the OpenAPI document: 2.0
7 * Contact: developers@squareup.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Timecard : A record of the hourly rate, start time, and end time of a single timecard (shift) for a team member. This might include a record of the start and end times of breaks taken during the shift.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Timecard {
17    /// **Read only** The Square-issued UUID for this object.
18    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
19    pub id: Option<String>,
20    /// The ID of the [location](entity:Location) for this timecard. The location should be based on where the team member clocked in.
21    #[serde(rename = "location_id")]
22    pub location_id: String,
23    /// **Read only** The time zone calculated from the location based on the `location_id`, provided as a convenience value. Format: the IANA time zone database identifier for the location time zone.
24    #[serde(rename = "timezone", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25    pub timezone: Option<Option<String>>,
26    /// The start time of the timecard, in RFC 3339 format and shifted to the location timezone + offset. Precision up to the minute is respected; seconds are truncated.
27    #[serde(rename = "start_at")]
28    pub start_at: String,
29    /// The end time of the timecard, in RFC 3339 format and shifted to the location timezone + offset. Precision up to the minute is respected; seconds are truncated.
30    #[serde(rename = "end_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub end_at: Option<Option<String>>,
32    #[serde(rename = "wage", skip_serializing_if = "Option::is_none")]
33    pub wage: Option<Box<models::TimecardWage>>,
34    /// A list of all the paid or unpaid breaks that were taken during this timecard.
35    #[serde(rename = "breaks", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
36    pub breaks: Option<Option<Vec<models::Break>>>,
37    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
38    pub status: Option<models::TimecardStatus>,
39    /// **Read only** The current version of the timecard, which is incremented with each update. This field is used for [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control to ensure that requests don't overwrite data from another request.
40    #[serde(rename = "version", skip_serializing_if = "Option::is_none")]
41    pub version: Option<i32>,
42    /// The timestamp of when the timecard was created, in RFC 3339 format presented as UTC.
43    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
44    pub created_at: Option<String>,
45    /// The timestamp of when the timecard was last updated, in RFC 3339 format presented as UTC.
46    #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")]
47    pub updated_at: Option<String>,
48    /// The ID of the [team member](entity:TeamMember) this timecard belongs to.
49    #[serde(rename = "team_member_id")]
50    pub team_member_id: String,
51    #[serde(rename = "declared_cash_tip_money", skip_serializing_if = "Option::is_none")]
52    pub declared_cash_tip_money: Option<Box<models::Money>>,
53}
54
55impl Timecard {
56    /// A record of the hourly rate, start time, and end time of a single timecard (shift) for a team member. This might include a record of the start and end times of breaks taken during the shift.
57    pub fn new(location_id: String, start_at: String, team_member_id: String) -> Timecard {
58        Timecard {
59            id: None,
60            location_id,
61            timezone: None,
62            start_at,
63            end_at: None,
64            wage: None,
65            breaks: None,
66            status: None,
67            version: None,
68            created_at: None,
69            updated_at: None,
70            team_member_id,
71            declared_cash_tip_money: None,
72        }
73    }
74}
75