p7m_appointment/models/
availability.rs

1/*
2 * Appointments Backend
3 *
4 * # API for appointment scheduling related data  This is the API of the service at P7M that manages the scheduling and management of appointments. It is used by the booking widget (see the **WidgetApi** tag) with functions that are public and don't require the user to be authenticated.  For endpoints in other tags the caller has to be authenticated with the system and provide a JWT token in the Authorization header of the HTTP request. When using the API you typically get this token by authenticating first with OAuth 2.0.  When you are trying this API using the Swagger interface, you need to click the `Authorize` button and then again the Authorize button in the pop-up that gets opened.
5 *
6 * The version of the OpenAPI document: 0.13.5
7 * Contact: tech@p7m.de
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Availability : Definition of a time slot, that is available regularly for booking
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Availability {
17    /// ID of this availability
18    #[serde(rename = "availabilityId")]
19    pub availability_id: uuid::Uuid,
20    /// the tenant this availability belongs to
21    #[serde(rename = "tenantId")]
22    pub tenant_id: uuid::Uuid,
23    /// this availability is for this worker
24    #[serde(rename = "workerId")]
25    pub worker_id: uuid::Uuid,
26    /// which day of the week this availability is for
27    #[serde(rename = "dayOfWeek")]
28    pub day_of_week: models::DayOfWeek,
29    /// time of the day this availability starts
30    #[serde(rename = "startTime")]
31    pub start_time: String,
32    /// time of the day this availability ends
33    #[serde(rename = "endTime")]
34    pub end_time: String,
35    /// list of services available for this availability (empty for all services available)
36    #[serde(rename = "services")]
37    pub services: Vec<uuid::Uuid>,
38    /// limit the availability to a certain date range (start date, inclusive)
39    #[serde(rename = "notBefore", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
40    pub not_before: Option<Option<String>>,
41    /// limit the availability to a certain date range (end date, inclusive)
42    #[serde(rename = "notAfter", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
43    pub not_after: Option<Option<String>>,
44}
45
46impl Availability {
47    /// Definition of a time slot, that is available regularly for booking
48    pub fn new(availability_id: uuid::Uuid, tenant_id: uuid::Uuid, worker_id: uuid::Uuid, day_of_week: models::DayOfWeek, start_time: String, end_time: String, services: Vec<uuid::Uuid>) -> Availability {
49        Availability {
50            availability_id,
51            tenant_id,
52            worker_id,
53            day_of_week,
54            start_time,
55            end_time,
56            services,
57            not_before: None,
58            not_after: None,
59        }
60    }
61}
62