remote_api/
types.rs

1#![doc = r" This module contains the generated types for the library."]
2#[cfg(feature = "tabled")]
3use tabled::Tabled;
4pub mod base64 {
5    #![doc = " Base64 data that encodes to url safe base64, but can decode from multiple"]
6    #![doc = " base64 implementations to account for various clients and libraries. Compatible"]
7    #![doc = " with serde and JsonSchema."]
8    use std::{convert::TryFrom, fmt};
9
10    use serde::{
11        de::{Error, Unexpected, Visitor},
12        Deserialize, Deserializer, Serialize, Serializer,
13    };
14    static ALLOWED_DECODING_FORMATS: &[data_encoding::Encoding] = &[
15        data_encoding::BASE64,
16        data_encoding::BASE64URL,
17        data_encoding::BASE64URL_NOPAD,
18        data_encoding::BASE64_MIME,
19        data_encoding::BASE64_NOPAD,
20    ];
21    #[derive(Debug, Clone, PartialEq, Eq)]
22    #[doc = " A container for binary that should be base64 encoded in serialisation. In reverse"]
23    #[doc = " when deserializing, will decode from many different types of base64 possible."]
24    pub struct Base64Data(pub Vec<u8>);
25    impl Base64Data {
26        #[doc = " Return is the data is empty."]
27        pub fn is_empty(&self) -> bool {
28            self.0.is_empty()
29        }
30    }
31
32    impl fmt::Display for Base64Data {
33        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
34            write!(f, "{}", data_encoding::BASE64URL_NOPAD.encode(&self.0))
35        }
36    }
37
38    impl From<Base64Data> for Vec<u8> {
39        fn from(data: Base64Data) -> Vec<u8> {
40            data.0
41        }
42    }
43
44    impl From<Vec<u8>> for Base64Data {
45        fn from(data: Vec<u8>) -> Base64Data {
46            Base64Data(data)
47        }
48    }
49
50    impl AsRef<[u8]> for Base64Data {
51        fn as_ref(&self) -> &[u8] {
52            &self.0
53        }
54    }
55
56    impl TryFrom<&str> for Base64Data {
57        type Error = anyhow::Error;
58        fn try_from(v: &str) -> Result<Self, Self::Error> {
59            for config in ALLOWED_DECODING_FORMATS {
60                if let Ok(data) = config.decode(v.as_bytes()) {
61                    return Ok(Base64Data(data));
62                }
63            }
64            anyhow::bail!("Could not decode base64 data: {}", v);
65        }
66    }
67
68    struct Base64DataVisitor;
69    impl<'de> Visitor<'de> for Base64DataVisitor {
70        type Value = Base64Data;
71        fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
72            write!(formatter, "a base64 encoded string")
73        }
74
75        fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
76        where
77            E: Error,
78        {
79            for config in ALLOWED_DECODING_FORMATS {
80                if let Ok(data) = config.decode(v.as_bytes()) {
81                    return Ok(Base64Data(data));
82                }
83            }
84            Err(serde::de::Error::invalid_value(Unexpected::Str(v), &self))
85        }
86    }
87
88    impl<'de> Deserialize<'de> for Base64Data {
89        fn deserialize<D>(deserializer: D) -> Result<Self, <D as Deserializer<'de>>::Error>
90        where
91            D: Deserializer<'de>,
92        {
93            deserializer.deserialize_str(Base64DataVisitor)
94        }
95    }
96
97    impl Serialize for Base64Data {
98        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
99        where
100            S: Serializer,
101        {
102            let encoded = data_encoding::BASE64URL_NOPAD.encode(&self.0);
103            serializer.serialize_str(&encoded)
104        }
105    }
106
107    impl schemars::JsonSchema for Base64Data {
108        fn schema_name() -> String {
109            "Base64Data".to_string()
110        }
111
112        fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
113            let mut obj = gen.root_schema_for::<String>().schema;
114            obj.format = Some("byte".to_string());
115            schemars::schema::Schema::Object(obj)
116        }
117
118        fn is_referenceable() -> bool {
119            false
120        }
121    }
122
123    #[cfg(test)]
124    mod tests {
125        use std::convert::TryFrom;
126
127        use super::Base64Data;
128        #[test]
129        fn test_base64_try_from() {
130            assert!(Base64Data::try_from("aGVsbG8=").is_ok());
131            assert!(Base64Data::try_from("abcdefghij").is_err());
132        }
133    }
134}
135
136#[cfg(feature = "requests")]
137pub mod multipart {
138    #![doc = " Multipart form data types."]
139    #[doc = " An attachement to a multipart form."]
140    #[derive(Debug, Clone, PartialEq, Eq, Hash)]
141    pub struct Attachment {
142        #[doc = " The name of the field."]
143        pub name: String,
144        #[doc = " The filename of the attachment."]
145        pub filename: Option<String>,
146        #[doc = " The content type of the attachment."]
147        pub content_type: Option<String>,
148        #[doc = " The data of the attachment."]
149        pub data: Vec<u8>,
150    }
151
152    impl std::convert::TryFrom<Attachment> for reqwest::multipart::Part {
153        type Error = reqwest::Error;
154        fn try_from(attachment: Attachment) -> Result<Self, Self::Error> {
155            let mut part = reqwest::multipart::Part::bytes(attachment.data);
156            if let Some(filename) = attachment.filename {
157                part = part.file_name(filename);
158            }
159            if let Some(content_type) = attachment.content_type {
160                part = part.mime_str(&content_type)?;
161            }
162            Ok(part)
163        }
164    }
165
166    impl std::convert::TryFrom<std::path::PathBuf> for Attachment {
167        type Error = std::io::Error;
168        fn try_from(path: std::path::PathBuf) -> Result<Self, Self::Error> {
169            let filename = path
170                .file_name()
171                .ok_or_else(|| {
172                    std::io::Error::new(std::io::ErrorKind::InvalidData, "invalid filename")
173                })?
174                .to_str()
175                .ok_or_else(|| {
176                    std::io::Error::new(std::io::ErrorKind::InvalidData, "invalid filename")
177                })?
178                .to_string();
179            let content_type = mime_guess::from_path(&path).first_raw();
180            let data = std::fs::read(path)?;
181            Ok(Attachment {
182                name: "file".to_string(),
183                filename: Some(filename),
184                content_type: content_type.map(|s| s.to_string()),
185                data,
186            })
187        }
188    }
189}
190
191#[cfg(feature = "requests")]
192pub mod paginate {
193    #![doc = " Utility functions used for pagination."]
194    use anyhow::Result;
195    #[doc = " A trait for types that allow pagination."]
196    pub trait Pagination {
197        #[doc = " The item that is paginated."]
198        type Item: serde::de::DeserializeOwned;
199        #[doc = " Returns true if the response has more pages."]
200        fn has_more_pages(&self) -> bool;
201        #[doc = " Returns the next page token."]
202        fn next_page_token(&self) -> Option<String>;
203        #[doc = " Modify a request to get the next page."]
204        fn next_page(
205            &self,
206            req: reqwest::Request,
207        ) -> Result<reqwest::Request, crate::types::error::Error>;
208        #[doc = " Get the items from a page."]
209        fn items(&self) -> Vec<Self::Item>;
210    }
211}
212
213pub mod phone_number {
214    #![doc = " A library to implement phone numbers for our database and JSON serialization and \
215              deserialization."]
216    use std::str::FromStr;
217
218    use schemars::JsonSchema;
219    #[doc = " A phone number."]
220    #[derive(Debug, Default, Clone, PartialEq, Hash, Eq)]
221    pub struct PhoneNumber(pub Option<phonenumber::PhoneNumber>);
222    impl From<phonenumber::PhoneNumber> for PhoneNumber {
223        fn from(id: phonenumber::PhoneNumber) -> PhoneNumber {
224            PhoneNumber(Some(id))
225        }
226    }
227
228    impl AsRef<Option<phonenumber::PhoneNumber>> for PhoneNumber {
229        fn as_ref(&self) -> &Option<phonenumber::PhoneNumber> {
230            &self.0
231        }
232    }
233
234    impl std::ops::Deref for PhoneNumber {
235        type Target = Option<phonenumber::PhoneNumber>;
236        fn deref(&self) -> &Self::Target {
237            &self.0
238        }
239    }
240
241    impl serde::ser::Serialize for PhoneNumber {
242        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
243        where
244            S: serde::ser::Serializer,
245        {
246            serializer.serialize_str(&self.to_string())
247        }
248    }
249
250    impl<'de> serde::de::Deserialize<'de> for PhoneNumber {
251        fn deserialize<D>(deserializer: D) -> Result<PhoneNumber, D::Error>
252        where
253            D: serde::de::Deserializer<'de>,
254        {
255            let s = String::deserialize(deserializer).unwrap_or_default();
256            PhoneNumber::from_str(&s).map_err(serde::de::Error::custom)
257        }
258    }
259
260    impl std::str::FromStr for PhoneNumber {
261        type Err = anyhow::Error;
262        fn from_str(s: &str) -> Result<Self, Self::Err> {
263            if s.trim().is_empty() {
264                return Ok(PhoneNumber(None));
265            }
266            let s = if !s.trim().starts_with('+') {
267                format!("+1{s}")
268            } else {
269                s.to_string()
270            }
271            .replace(['-', '(', ')', ' '], "");
272            Ok(PhoneNumber(Some(phonenumber::parse(None, &s).map_err(
273                |e| anyhow::anyhow!("invalid phone number `{}`: {}", s, e),
274            )?)))
275        }
276    }
277
278    impl std::fmt::Display for PhoneNumber {
279        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
280            let s = if let Some(phone) = &self.0 {
281                phone
282                    .format()
283                    .mode(phonenumber::Mode::International)
284                    .to_string()
285            } else {
286                String::new()
287            };
288            write!(f, "{}", s)
289        }
290    }
291
292    impl JsonSchema for PhoneNumber {
293        fn schema_name() -> String {
294            "PhoneNumber".to_string()
295        }
296
297        fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
298            let mut obj = gen.root_schema_for::<String>().schema;
299            obj.format = Some("phone".to_string());
300            schemars::schema::Schema::Object(obj)
301        }
302
303        fn is_referenceable() -> bool {
304            false
305        }
306    }
307
308    #[cfg(test)]
309    mod test {
310        use pretty_assertions::assert_eq;
311
312        use super::PhoneNumber;
313        #[test]
314        fn test_parse_phone_number() {
315            let mut phone = "+1-555-555-5555";
316            let mut phone_parsed: PhoneNumber =
317                serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
318            let mut expected = PhoneNumber(Some(phonenumber::parse(None, phone).unwrap()));
319            assert_eq!(phone_parsed, expected);
320            let mut expected_str = "+1 555-555-5555";
321            assert_eq!(expected_str, serde_json::json!(phone_parsed));
322            phone = "555-555-5555";
323            phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
324            assert_eq!(phone_parsed, expected);
325            assert_eq!(expected_str, serde_json::json!(phone_parsed));
326            phone = "+1 555-555-5555";
327            phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
328            assert_eq!(phone_parsed, expected);
329            assert_eq!(expected_str, serde_json::json!(phone_parsed));
330            phone = "5555555555";
331            phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
332            assert_eq!(phone_parsed, expected);
333            assert_eq!(expected_str, serde_json::json!(phone_parsed));
334            phone = "(510) 864-1234";
335            phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
336            expected = PhoneNumber(Some(phonenumber::parse(None, "+15108641234").unwrap()));
337            assert_eq!(phone_parsed, expected);
338            expected_str = "+1 510-864-1234";
339            assert_eq!(expected_str, serde_json::json!(phone_parsed));
340            phone = "(510)8641234";
341            phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
342            assert_eq!(phone_parsed, expected);
343            expected_str = "+1 510-864-1234";
344            assert_eq!(expected_str, serde_json::json!(phone_parsed));
345            phone = "";
346            phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
347            assert_eq!(phone_parsed, PhoneNumber(None));
348            assert_eq!("", serde_json::json!(phone_parsed));
349            phone = "+49 30  1234 1234";
350            phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
351            expected = PhoneNumber(Some(phonenumber::parse(None, phone).unwrap()));
352            assert_eq!(phone_parsed, expected);
353            expected_str = "+49 30 12341234";
354            assert_eq!(expected_str, serde_json::json!(phone_parsed));
355        }
356    }
357}
358
359#[cfg(feature = "requests")]
360pub mod error {
361    #![doc = " Error methods."]
362    #[doc = " Error produced by generated client methods."]
363    pub enum Error {
364        #[doc = " The request did not conform to API requirements."]
365        InvalidRequest(String),
366        #[cfg(feature = "retry")]
367        #[doc = " A server error either due to the data, or with the connection."]
368        CommunicationError(reqwest_middleware::Error),
369        #[doc = " A request error, caused when building the request."]
370        RequestError(reqwest::Error),
371        #[doc = " An expected response whose deserialization failed."]
372        SerdeError {
373            #[doc = " The error."]
374            error: format_serde_error::SerdeError,
375            #[doc = " The response status."]
376            status: reqwest::StatusCode,
377        },
378        #[doc = " An expected error response."]
379        InvalidResponsePayload {
380            #[cfg(feature = "retry")]
381            #[doc = " The error."]
382            error: reqwest_middleware::Error,
383            #[cfg(not(feature = "retry"))]
384            #[doc = " The error."]
385            error: reqwest::Error,
386            #[doc = " The full response."]
387            response: reqwest::Response,
388        },
389        #[doc = " An error from the server."]
390        Server {
391            #[doc = " The text from the body."]
392            body: String,
393            #[doc = " The response status."]
394            status: reqwest::StatusCode,
395        },
396        #[doc = " A response not listed in the API description. This may represent a"]
397        #[doc = " success or failure response; check `status().is_success()`."]
398        UnexpectedResponse(reqwest::Response),
399    }
400
401    impl Error {
402        #[doc = " Returns the status code, if the error was generated from a response."]
403        pub fn status(&self) -> Option<reqwest::StatusCode> {
404            match self {
405                Error::InvalidRequest(_) => None,
406                Error::RequestError(e) => e.status(),
407                #[cfg(feature = "retry")]
408                Error::CommunicationError(reqwest_middleware::Error::Reqwest(e)) => e.status(),
409                #[cfg(feature = "retry")]
410                Error::CommunicationError(reqwest_middleware::Error::Middleware(_)) => None,
411                Error::SerdeError { error: _, status } => Some(*status),
412                Error::InvalidResponsePayload { error: _, response } => Some(response.status()),
413                Error::Server { body: _, status } => Some(*status),
414                Error::UnexpectedResponse(r) => Some(r.status()),
415            }
416        }
417
418        #[doc = " Creates a new error from a response status and a serde error."]
419        pub fn from_serde_error(
420            e: format_serde_error::SerdeError,
421            status: reqwest::StatusCode,
422        ) -> Self {
423            Self::SerdeError { error: e, status }
424        }
425    }
426
427    #[cfg(feature = "retry")]
428    impl From<reqwest_middleware::Error> for Error {
429        fn from(e: reqwest_middleware::Error) -> Self {
430            Self::CommunicationError(e)
431        }
432    }
433
434    impl From<reqwest::Error> for Error {
435        fn from(e: reqwest::Error) -> Self {
436            Self::RequestError(e)
437        }
438    }
439
440    impl From<serde_json::Error> for Error {
441        fn from(e: serde_json::Error) -> Self {
442            Self::SerdeError {
443                error: format_serde_error::SerdeError::new(String::new(), e),
444                status: reqwest::StatusCode::INTERNAL_SERVER_ERROR,
445            }
446        }
447    }
448
449    impl std::fmt::Display for Error {
450        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
451            match self {
452                Error::InvalidRequest(s) => {
453                    write!(f, "Invalid Request: {}", s)
454                }
455                #[cfg(feature = "retry")]
456                Error::CommunicationError(e) => {
457                    write!(f, "Communication Error: {}", e)
458                }
459                Error::RequestError(e) => {
460                    write!(f, "Request Error: {}", e)
461                }
462                Error::SerdeError { error, status: _ } => {
463                    write!(f, "Serde Error: {}", error)
464                }
465                Error::InvalidResponsePayload { error, response: _ } => {
466                    write!(f, "Invalid Response Payload: {}", error)
467                }
468                Error::Server { body, status } => {
469                    write!(f, "Server Error: {} {}", status, body)
470                }
471                Error::UnexpectedResponse(r) => {
472                    write!(f, "Unexpected Response: {:?}", r)
473                }
474            }
475        }
476    }
477
478    impl std::fmt::Debug for Error {
479        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
480            std::fmt::Display::fmt(self, f)
481        }
482    }
483
484    impl std::error::Error for Error {
485        fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
486            match self {
487                #[cfg(feature = "retry")]
488                Error::CommunicationError(e) => Some(e),
489                Error::SerdeError { error, status: _ } => Some(error),
490                Error::InvalidResponsePayload { error, response: _ } => Some(error),
491                _ => None,
492            }
493        }
494    }
495}
496
497#[doc = "The status of the task"]
498#[derive(
499    serde :: Serialize,
500    serde :: Deserialize,
501    PartialEq,
502    Hash,
503    Debug,
504    Clone,
505    schemars :: JsonSchema,
506    parse_display :: FromStr,
507    parse_display :: Display,
508)]
509#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
510#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
511pub enum Status {
512    #[serde(rename = "completed")]
513    #[display("completed")]
514    Completed,
515    #[serde(rename = "pending")]
516    #[display("pending")]
517    Pending,
518}
519
520#[doc = "Description and status of an onboarding task."]
521#[derive(
522    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
523)]
524pub struct TaskDescription {
525    #[serde(default, skip_serializing_if = "Option::is_none")]
526    pub description: Option<String>,
527    #[doc = "The status of the task"]
528    #[serde(default, skip_serializing_if = "Option::is_none")]
529    pub status: Option<Status>,
530}
531
532impl std::fmt::Display for TaskDescription {
533    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
534        write!(
535            f,
536            "{}",
537            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
538        )
539    }
540}
541
542#[cfg(feature = "tabled")]
543impl tabled::Tabled for TaskDescription {
544    const LENGTH: usize = 2;
545    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
546        vec![
547            if let Some(description) = &self.description {
548                format!("{:?}", description).into()
549            } else {
550                String::new().into()
551            },
552            if let Some(status) = &self.status {
553                format!("{:?}", status).into()
554            } else {
555                String::new().into()
556            },
557        ]
558    }
559
560    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
561        vec!["description".into(), "status".into()]
562    }
563}
564
565#[doc = "A supported file"]
566#[derive(
567    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
568)]
569pub struct File {
570    pub id: String,
571    #[serde(deserialize_with = "crate::utils::date_time_format::deserialize")]
572    pub inserted_at: chrono::DateTime<chrono::Utc>,
573    pub name: String,
574    #[serde(default, skip_serializing_if = "Option::is_none")]
575    pub sub_type: Option<String>,
576    #[serde(rename = "type")]
577    pub type_: String,
578}
579
580impl std::fmt::Display for File {
581    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
582        write!(
583            f,
584            "{}",
585            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
586        )
587    }
588}
589
590#[cfg(feature = "tabled")]
591impl tabled::Tabled for File {
592    const LENGTH: usize = 5;
593    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
594        vec![
595            self.id.clone().into(),
596            format!("{:?}", self.inserted_at).into(),
597            self.name.clone().into(),
598            if let Some(sub_type) = &self.sub_type {
599                format!("{:?}", sub_type).into()
600            } else {
601                String::new().into()
602            },
603            self.type_.clone().into(),
604        ]
605    }
606
607    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
608        vec![
609            "id".into(),
610            "inserted_at".into(),
611            "name".into(),
612            "sub_type".into(),
613            "type_".into(),
614        ]
615    }
616}
617
618#[derive(
619    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
620)]
621pub struct ConflictResponse {
622    #[serde(default, skip_serializing_if = "Option::is_none")]
623    pub message: Option<String>,
624}
625
626impl std::fmt::Display for ConflictResponse {
627    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
628        write!(
629            f,
630            "{}",
631            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
632        )
633    }
634}
635
636#[cfg(feature = "tabled")]
637impl tabled::Tabled for ConflictResponse {
638    const LENGTH: usize = 1;
639    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
640        vec![if let Some(message) = &self.message {
641            format!("{:?}", message).into()
642        } else {
643            String::new().into()
644        }]
645    }
646
647    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
648        vec!["message".into()]
649    }
650}
651
652#[derive(
653    serde :: Serialize,
654    serde :: Deserialize,
655    PartialEq,
656    Hash,
657    Debug,
658    Clone,
659    schemars :: JsonSchema,
660    parse_display :: FromStr,
661    parse_display :: Display,
662)]
663#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
664#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
665pub enum TimeoffType {
666    #[serde(rename = "paid_time_off")]
667    #[display("paid_time_off")]
668    PaidTimeOff,
669    #[serde(rename = "sick_leave")]
670    #[display("sick_leave")]
671    SickLeave,
672    #[serde(rename = "public_holiday")]
673    #[display("public_holiday")]
674    PublicHoliday,
675    #[serde(rename = "unpaid_leave")]
676    #[display("unpaid_leave")]
677    UnpaidLeave,
678    #[serde(rename = "extended_leave")]
679    #[display("extended_leave")]
680    ExtendedLeave,
681    #[serde(rename = "in_lieu_time")]
682    #[display("in_lieu_time")]
683    InLieuTime,
684    #[serde(rename = "maternity_leave")]
685    #[display("maternity_leave")]
686    MaternityLeave,
687    #[serde(rename = "paternity_leave")]
688    #[display("paternity_leave")]
689    PaternityLeave,
690    #[serde(rename = "parental_leave")]
691    #[display("parental_leave")]
692    ParentalLeave,
693    #[serde(rename = "bereavement")]
694    #[display("bereavement")]
695    Bereavement,
696    #[serde(rename = "military_leave")]
697    #[display("military_leave")]
698    MilitaryLeave,
699    #[serde(rename = "other")]
700    #[display("other")]
701    Other,
702}
703
704#[derive(
705    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
706)]
707pub struct Creator {
708    #[serde(default, skip_serializing_if = "Option::is_none")]
709    pub name: Option<String>,
710}
711
712impl std::fmt::Display for Creator {
713    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
714        write!(
715            f,
716            "{}",
717            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
718        )
719    }
720}
721
722#[cfg(feature = "tabled")]
723impl tabled::Tabled for Creator {
724    const LENGTH: usize = 1;
725    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
726        vec![if let Some(name) = &self.name {
727            format!("{:?}", name).into()
728        } else {
729            String::new().into()
730        }]
731    }
732
733    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
734        vec!["name".into()]
735    }
736}
737
738#[derive(
739    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
740)]
741pub struct LastEditor {
742    #[serde(default, skip_serializing_if = "Option::is_none")]
743    pub name: Option<String>,
744}
745
746impl std::fmt::Display for LastEditor {
747    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
748        write!(
749            f,
750            "{}",
751            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
752        )
753    }
754}
755
756#[cfg(feature = "tabled")]
757impl tabled::Tabled for LastEditor {
758    const LENGTH: usize = 1;
759    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
760        vec![if let Some(name) = &self.name {
761            format!("{:?}", name).into()
762        } else {
763            String::new().into()
764        }]
765    }
766
767    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
768        vec!["name".into()]
769    }
770}
771
772#[doc = "Payroll run product type"]
773#[derive(
774    serde :: Serialize,
775    serde :: Deserialize,
776    PartialEq,
777    Hash,
778    Debug,
779    Clone,
780    schemars :: JsonSchema,
781    parse_display :: FromStr,
782    parse_display :: Display,
783)]
784#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
785#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
786pub enum ProductType {
787    #[serde(rename = "eor")]
788    #[display("eor")]
789    Eor,
790    #[serde(rename = "global_payroll")]
791    #[display("global_payroll")]
792    GlobalPayroll,
793}
794
795#[doc = "Status of the payroll"]
796#[derive(
797    serde :: Serialize,
798    serde :: Deserialize,
799    PartialEq,
800    Hash,
801    Debug,
802    Clone,
803    schemars :: JsonSchema,
804    parse_display :: FromStr,
805    parse_display :: Display,
806)]
807#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
808#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
809pub enum PayrollRunStatus {
810    #[serde(rename = "preparing")]
811    #[display("preparing")]
812    Preparing,
813    #[serde(rename = "processing")]
814    #[display("processing")]
815    Processing,
816    #[serde(rename = "waiting_for_customer_approval")]
817    #[display("waiting_for_customer_approval")]
818    WaitingForCustomerApproval,
819    #[serde(rename = "completed")]
820    #[display("completed")]
821    Completed,
822    #[serde(rename = "finalized")]
823    #[display("finalized")]
824    Finalized,
825    #[serde(rename = "rejected")]
826    #[display("rejected")]
827    Rejected,
828}
829
830#[doc = "Payroll Run type"]
831#[derive(
832    serde :: Serialize,
833    serde :: Deserialize,
834    PartialEq,
835    Hash,
836    Debug,
837    Clone,
838    schemars :: JsonSchema,
839    parse_display :: FromStr,
840    parse_display :: Display,
841)]
842#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
843#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
844pub enum Type {
845    #[serde(rename = "main")]
846    #[display("main")]
847    Main,
848    #[serde(rename = "one_off")]
849    #[display("one_off")]
850    OneOff,
851    #[serde(rename = "pro_forma")]
852    #[display("pro_forma")]
853    ProForma,
854}
855
856#[derive(
857    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
858)]
859pub struct PayrollRun {
860    #[serde(default, skip_serializing_if = "Option::is_none")]
861    pub creator: Option<Creator>,
862    #[doc = "Indicates if an Employer has completed the Payroll Inputs review flow"]
863    #[serde(default, skip_serializing_if = "Option::is_none")]
864    pub customer_inputs_reviewed: Option<bool>,
865    #[serde(default, skip_serializing_if = "Option::is_none")]
866    pub field_for_employment_matching: Option<String>,
867    #[serde(default, skip_serializing_if = "Option::is_none")]
868    pub inserted_at: Option<chrono::DateTime<chrono::Utc>>,
869    #[serde(default, skip_serializing_if = "Option::is_none")]
870    pub last_editor: Option<LastEditor>,
871    pub legal_entity: RemoteEntity,
872    #[serde(default, skip_serializing_if = "Option::is_none")]
873    pub mapping_rules: Option<Vec<String>>,
874    #[doc = "Name of the payroll_run to be displayed for users"]
875    #[serde(default, skip_serializing_if = "Option::is_none")]
876    pub name: Option<String>,
877    #[serde(default, skip_serializing_if = "Option::is_none")]
878    pub net_pay_extraction_expression: Option<String>,
879    #[doc = "The end date the payroll run is for"]
880    pub period_end: chrono::NaiveDate,
881    #[doc = "The start date the payroll run is for"]
882    pub period_start: chrono::NaiveDate,
883    #[doc = "Payroll run product type"]
884    #[serde(default, skip_serializing_if = "Option::is_none")]
885    pub product_type: Option<ProductType>,
886    pub slug: String,
887    #[doc = "Status of the payroll"]
888    pub status: PayrollRunStatus,
889    pub summarize_automatically: bool,
890    #[doc = "Payroll Run type"]
891    #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
892    pub type_: Option<Type>,
893    #[serde(default, skip_serializing_if = "Option::is_none")]
894    pub validations: Option<serde_json::Value>,
895}
896
897impl std::fmt::Display for PayrollRun {
898    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
899        write!(
900            f,
901            "{}",
902            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
903        )
904    }
905}
906
907#[cfg(feature = "tabled")]
908impl tabled::Tabled for PayrollRun {
909    const LENGTH: usize = 17;
910    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
911        vec![
912            if let Some(creator) = &self.creator {
913                format!("{:?}", creator).into()
914            } else {
915                String::new().into()
916            },
917            if let Some(customer_inputs_reviewed) = &self.customer_inputs_reviewed {
918                format!("{:?}", customer_inputs_reviewed).into()
919            } else {
920                String::new().into()
921            },
922            if let Some(field_for_employment_matching) = &self.field_for_employment_matching {
923                format!("{:?}", field_for_employment_matching).into()
924            } else {
925                String::new().into()
926            },
927            if let Some(inserted_at) = &self.inserted_at {
928                format!("{:?}", inserted_at).into()
929            } else {
930                String::new().into()
931            },
932            if let Some(last_editor) = &self.last_editor {
933                format!("{:?}", last_editor).into()
934            } else {
935                String::new().into()
936            },
937            format!("{:?}", self.legal_entity).into(),
938            if let Some(mapping_rules) = &self.mapping_rules {
939                format!("{:?}", mapping_rules).into()
940            } else {
941                String::new().into()
942            },
943            if let Some(name) = &self.name {
944                format!("{:?}", name).into()
945            } else {
946                String::new().into()
947            },
948            if let Some(net_pay_extraction_expression) = &self.net_pay_extraction_expression {
949                format!("{:?}", net_pay_extraction_expression).into()
950            } else {
951                String::new().into()
952            },
953            format!("{:?}", self.period_end).into(),
954            format!("{:?}", self.period_start).into(),
955            if let Some(product_type) = &self.product_type {
956                format!("{:?}", product_type).into()
957            } else {
958                String::new().into()
959            },
960            self.slug.clone().into(),
961            format!("{:?}", self.status).into(),
962            format!("{:?}", self.summarize_automatically).into(),
963            if let Some(type_) = &self.type_ {
964                format!("{:?}", type_).into()
965            } else {
966                String::new().into()
967            },
968            if let Some(validations) = &self.validations {
969                format!("{:?}", validations).into()
970            } else {
971                String::new().into()
972            },
973        ]
974    }
975
976    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
977        vec![
978            "creator".into(),
979            "customer_inputs_reviewed".into(),
980            "field_for_employment_matching".into(),
981            "inserted_at".into(),
982            "last_editor".into(),
983            "legal_entity".into(),
984            "mapping_rules".into(),
985            "name".into(),
986            "net_pay_extraction_expression".into(),
987            "period_end".into(),
988            "period_start".into(),
989            "product_type".into(),
990            "slug".into(),
991            "status".into(),
992            "summarize_automatically".into(),
993            "type_".into(),
994            "validations".into(),
995        ]
996    }
997}
998
999#[derive(
1000    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1001)]
1002pub struct Address {
1003    #[serde(default, skip_serializing_if = "Option::is_none")]
1004    pub address: Option<String>,
1005    #[serde(default, skip_serializing_if = "Option::is_none")]
1006    pub address_line_2: Option<String>,
1007    #[serde(default, skip_serializing_if = "Option::is_none")]
1008    pub city: Option<String>,
1009    #[serde(default, skip_serializing_if = "Option::is_none")]
1010    pub country: Option<AddressCountry>,
1011    #[serde(default, skip_serializing_if = "Option::is_none")]
1012    pub local_details: Option<serde_json::Value>,
1013    #[serde(default, skip_serializing_if = "Option::is_none")]
1014    pub postal_code: Option<String>,
1015    #[serde(default, skip_serializing_if = "Option::is_none")]
1016    pub slug: Option<String>,
1017    #[serde(default, skip_serializing_if = "Option::is_none")]
1018    pub state: Option<String>,
1019}
1020
1021impl std::fmt::Display for Address {
1022    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1023        write!(
1024            f,
1025            "{}",
1026            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1027        )
1028    }
1029}
1030
1031#[cfg(feature = "tabled")]
1032impl tabled::Tabled for Address {
1033    const LENGTH: usize = 8;
1034    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1035        vec![
1036            if let Some(address) = &self.address {
1037                format!("{:?}", address).into()
1038            } else {
1039                String::new().into()
1040            },
1041            if let Some(address_line_2) = &self.address_line_2 {
1042                format!("{:?}", address_line_2).into()
1043            } else {
1044                String::new().into()
1045            },
1046            if let Some(city) = &self.city {
1047                format!("{:?}", city).into()
1048            } else {
1049                String::new().into()
1050            },
1051            if let Some(country) = &self.country {
1052                format!("{:?}", country).into()
1053            } else {
1054                String::new().into()
1055            },
1056            if let Some(local_details) = &self.local_details {
1057                format!("{:?}", local_details).into()
1058            } else {
1059                String::new().into()
1060            },
1061            if let Some(postal_code) = &self.postal_code {
1062                format!("{:?}", postal_code).into()
1063            } else {
1064                String::new().into()
1065            },
1066            if let Some(slug) = &self.slug {
1067                format!("{:?}", slug).into()
1068            } else {
1069                String::new().into()
1070            },
1071            if let Some(state) = &self.state {
1072                format!("{:?}", state).into()
1073            } else {
1074                String::new().into()
1075            },
1076        ]
1077    }
1078
1079    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1080        vec![
1081            "address".into(),
1082            "address_line_2".into(),
1083            "city".into(),
1084            "country".into(),
1085            "local_details".into(),
1086            "postal_code".into(),
1087            "slug".into(),
1088            "state".into(),
1089        ]
1090    }
1091}
1092
1093#[derive(
1094    serde :: Serialize,
1095    serde :: Deserialize,
1096    PartialEq,
1097    Hash,
1098    Debug,
1099    Clone,
1100    schemars :: JsonSchema,
1101    parse_display :: FromStr,
1102    parse_display :: Display,
1103)]
1104#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
1105#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
1106pub enum EmploymentType {
1107    #[serde(rename = "employee")]
1108    #[display("employee")]
1109    Employee,
1110    #[serde(rename = "contractor")]
1111    #[display("contractor")]
1112    Contractor,
1113}
1114
1115#[doc = "Complete information of an employment"]
1116#[derive(
1117    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1118)]
1119pub struct Employment {
1120    #[doc = "Home address information. As its properties may vary depending on the country,\nyou must query the [Show form schema](https://gateway.remote.com/eor/v1/docs/openapi.html#tag/Countries/operation/get_show_form_country) endpoint\npassing the country code and `address_details` as path parameters."]
1121    #[serde(default, skip_serializing_if = "Option::is_none")]
1122    pub address_details: Option<serde_json::Value>,
1123    #[doc = "Administrative information. As its properties may vary depending on the country,\nyou must query the [Show form schema](https://gateway.remote.com/eor/v1/docs/openapi.html#tag/Countries/operation/get_show_form_country) endpoint\npassing the country code and `administrative_details` as path parameters."]
1124    #[serde(default, skip_serializing_if = "Option::is_none")]
1125    pub administrative_details: Option<serde_json::Value>,
1126    #[serde(default, skip_serializing_if = "Option::is_none")]
1127    pub bank_account_details: Option<Vec<serde_json::Value>>,
1128    #[doc = "Billing address information. As its properties may vary depending on the country,\nyou must query the [Show form schema](https://gateway.remote.com/eor/v1/docs/openapi.html#tag/Countries/operation/get_show_form_country) endpoint\npassing the country code and `billing_address_details` as path parameters."]
1129    #[serde(default, skip_serializing_if = "Option::is_none")]
1130    pub billing_address_details: Option<serde_json::Value>,
1131    pub company_id: String,
1132    #[doc = "Contract information. As its properties may vary depending on the country,\nyou must query the [Show form schema](https://gateway.remote.com/eor/v1/docs/openapi.html#tag/Countries/operation/get_show_form_country) endpoint\npassing the country code and `contract_details` as path parameters."]
1133    #[serde(default, skip_serializing_if = "Option::is_none")]
1134    pub contract_details: Option<serde_json::Value>,
1135    #[serde(default, skip_serializing_if = "Option::is_none")]
1136    pub country_code: Option<String>,
1137    #[doc = "A supported country on Remote"]
1138    #[serde(default, skip_serializing_if = "Option::is_none")]
1139    pub country: Option<Country>,
1140    pub created_at: String,
1141    #[doc = "Emergency contact information. Its properties may vary depending on the country."]
1142    #[serde(default, skip_serializing_if = "Option::is_none")]
1143    pub emergency_contact_details: Option<serde_json::Value>,
1144    #[serde(default, skip_serializing_if = "Option::is_none")]
1145    pub files: Option<Vec<File>>,
1146    pub full_name: String,
1147    pub id: String,
1148    #[serde(default, skip_serializing_if = "Option::is_none")]
1149    pub job_title: Option<String>,
1150    #[doc = "All tasks that need to be completed before marking the employment as ready"]
1151    #[serde(default, skip_serializing_if = "Option::is_none")]
1152    pub onboarding_tasks: Option<OnboardingTasks>,
1153    #[doc = "Personal details information. As its properties may vary depending on the country,\nyou must query the [Show form schema](https://gateway.remote.com/eor/v1/docs/openapi.html#tag/Countries/operation/get_show_form_country) endpoint\npassing the country code and `personal_details` as path parameters."]
1154    #[serde(default, skip_serializing_if = "Option::is_none")]
1155    pub personal_details: Option<serde_json::Value>,
1156    pub personal_email: String,
1157    #[doc = "Selected type of payment."]
1158    #[serde(default, skip_serializing_if = "Option::is_none")]
1159    pub pricing_plan_details: Option<PricingPlanDetails>,
1160    #[serde(default, skip_serializing_if = "Option::is_none")]
1161    pub provisional_start_date: Option<chrono::NaiveDate>,
1162    #[doc = "The status of employment"]
1163    #[serde(default, skip_serializing_if = "Option::is_none")]
1164    pub status: Option<EmploymentStatus>,
1165    #[serde(rename = "type")]
1166    pub type_: EmploymentType,
1167    #[serde(deserialize_with = "crate::utils::date_time_format::deserialize")]
1168    pub updated_at: chrono::DateTime<chrono::Utc>,
1169}
1170
1171impl std::fmt::Display for Employment {
1172    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1173        write!(
1174            f,
1175            "{}",
1176            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1177        )
1178    }
1179}
1180
1181#[cfg(feature = "tabled")]
1182impl tabled::Tabled for Employment {
1183    const LENGTH: usize = 22;
1184    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1185        vec![
1186            format!("{:?}", self.address_details).into(),
1187            format!("{:?}", self.administrative_details).into(),
1188            format!("{:?}", self.bank_account_details).into(),
1189            format!("{:?}", self.billing_address_details).into(),
1190            self.company_id.clone().into(),
1191            format!("{:?}", self.contract_details).into(),
1192            if let Some(country_code) = &self.country_code {
1193                format!("{:?}", country_code).into()
1194            } else {
1195                String::new().into()
1196            },
1197            if let Some(country) = &self.country {
1198                format!("{:?}", country).into()
1199            } else {
1200                String::new().into()
1201            },
1202            self.created_at.clone().into(),
1203            format!("{:?}", self.emergency_contact_details).into(),
1204            if let Some(files) = &self.files {
1205                format!("{:?}", files).into()
1206            } else {
1207                String::new().into()
1208            },
1209            self.full_name.clone().into(),
1210            self.id.clone().into(),
1211            format!("{:?}", self.job_title).into(),
1212            if let Some(onboarding_tasks) = &self.onboarding_tasks {
1213                format!("{:?}", onboarding_tasks).into()
1214            } else {
1215                String::new().into()
1216            },
1217            format!("{:?}", self.personal_details).into(),
1218            self.personal_email.clone().into(),
1219            format!("{:?}", self.pricing_plan_details).into(),
1220            if let Some(provisional_start_date) = &self.provisional_start_date {
1221                format!("{:?}", provisional_start_date).into()
1222            } else {
1223                String::new().into()
1224            },
1225            if let Some(status) = &self.status {
1226                format!("{:?}", status).into()
1227            } else {
1228                String::new().into()
1229            },
1230            format!("{:?}", self.type_).into(),
1231            format!("{:?}", self.updated_at).into(),
1232        ]
1233    }
1234
1235    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1236        vec![
1237            "address_details".into(),
1238            "administrative_details".into(),
1239            "bank_account_details".into(),
1240            "billing_address_details".into(),
1241            "company_id".into(),
1242            "contract_details".into(),
1243            "country_code".into(),
1244            "country".into(),
1245            "created_at".into(),
1246            "emergency_contact_details".into(),
1247            "files".into(),
1248            "full_name".into(),
1249            "id".into(),
1250            "job_title".into(),
1251            "onboarding_tasks".into(),
1252            "personal_details".into(),
1253            "personal_email".into(),
1254            "pricing_plan_details".into(),
1255            "provisional_start_date".into(),
1256            "status".into(),
1257            "type_".into(),
1258            "updated_at".into(),
1259        ]
1260    }
1261}
1262
1263#[derive(
1264    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1265)]
1266pub struct Data {
1267    #[doc = "The current page among all of the total_pages"]
1268    #[serde(default, skip_serializing_if = "Option::is_none")]
1269    pub current_page: Option<i64>,
1270    #[serde(default, skip_serializing_if = "Option::is_none")]
1271    pub employments: Option<Vec<MinimalEmployment>>,
1272    #[doc = "The total number of records in the result"]
1273    #[serde(default, skip_serializing_if = "Option::is_none")]
1274    pub total_count: Option<i64>,
1275    #[doc = "The total number of pages the user can go through"]
1276    #[serde(default, skip_serializing_if = "Option::is_none")]
1277    pub total_pages: Option<i64>,
1278}
1279
1280impl std::fmt::Display for Data {
1281    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1282        write!(
1283            f,
1284            "{}",
1285            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1286        )
1287    }
1288}
1289
1290#[cfg(feature = "tabled")]
1291impl tabled::Tabled for Data {
1292    const LENGTH: usize = 4;
1293    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1294        vec![
1295            if let Some(current_page) = &self.current_page {
1296                format!("{:?}", current_page).into()
1297            } else {
1298                String::new().into()
1299            },
1300            if let Some(employments) = &self.employments {
1301                format!("{:?}", employments).into()
1302            } else {
1303                String::new().into()
1304            },
1305            if let Some(total_count) = &self.total_count {
1306                format!("{:?}", total_count).into()
1307            } else {
1308                String::new().into()
1309            },
1310            if let Some(total_pages) = &self.total_pages {
1311                format!("{:?}", total_pages).into()
1312            } else {
1313                String::new().into()
1314            },
1315        ]
1316    }
1317
1318    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1319        vec![
1320            "current_page".into(),
1321            "employments".into(),
1322            "total_count".into(),
1323            "total_pages".into(),
1324        ]
1325    }
1326}
1327
1328#[doc = "Response schema listing many employments"]
1329#[derive(
1330    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1331)]
1332pub struct ListEmploymentsResponse {
1333    #[serde(default, skip_serializing_if = "Option::is_none")]
1334    pub data: Option<Data>,
1335}
1336
1337impl std::fmt::Display for ListEmploymentsResponse {
1338    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1339        write!(
1340            f,
1341            "{}",
1342            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1343        )
1344    }
1345}
1346
1347#[cfg(feature = "tabled")]
1348impl tabled::Tabled for ListEmploymentsResponse {
1349    const LENGTH: usize = 1;
1350    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1351        vec![if let Some(data) = &self.data {
1352            format!("{:?}", data).into()
1353        } else {
1354            String::new().into()
1355        }]
1356    }
1357
1358    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1359        vec!["data".into()]
1360    }
1361}
1362
1363#[derive(
1364    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1365)]
1366pub struct TimeoffResponseData {
1367    pub timeoff: Timeoff,
1368}
1369
1370impl std::fmt::Display for TimeoffResponseData {
1371    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1372        write!(
1373            f,
1374            "{}",
1375            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1376        )
1377    }
1378}
1379
1380#[cfg(feature = "tabled")]
1381impl tabled::Tabled for TimeoffResponseData {
1382    const LENGTH: usize = 1;
1383    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1384        vec![format!("{:?}", self.timeoff).into()]
1385    }
1386
1387    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1388        vec!["timeoff".into()]
1389    }
1390}
1391
1392#[doc = "Timeoff response"]
1393#[derive(
1394    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1395)]
1396pub struct TimeoffResponse {
1397    pub data: TimeoffResponseData,
1398}
1399
1400impl std::fmt::Display for TimeoffResponse {
1401    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1402        write!(
1403            f,
1404            "{}",
1405            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1406        )
1407    }
1408}
1409
1410#[cfg(feature = "tabled")]
1411impl tabled::Tabled for TimeoffResponse {
1412    const LENGTH: usize = 1;
1413    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1414        vec![format!("{:?}", self.data).into()]
1415    }
1416
1417    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1418        vec!["data".into()]
1419    }
1420}
1421
1422#[derive(
1423    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1424)]
1425pub struct ListTimeoffTypesResponseData {
1426    #[serde(default, skip_serializing_if = "Option::is_none")]
1427    pub description: Option<String>,
1428    #[serde(default, skip_serializing_if = "Option::is_none")]
1429    pub name: Option<TimeoffType>,
1430}
1431
1432impl std::fmt::Display for ListTimeoffTypesResponseData {
1433    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1434        write!(
1435            f,
1436            "{}",
1437            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1438        )
1439    }
1440}
1441
1442#[cfg(feature = "tabled")]
1443impl tabled::Tabled for ListTimeoffTypesResponseData {
1444    const LENGTH: usize = 2;
1445    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1446        vec![
1447            if let Some(description) = &self.description {
1448                format!("{:?}", description).into()
1449            } else {
1450                String::new().into()
1451            },
1452            if let Some(name) = &self.name {
1453                format!("{:?}", name).into()
1454            } else {
1455                String::new().into()
1456            },
1457        ]
1458    }
1459
1460    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1461        vec!["description".into(), "name".into()]
1462    }
1463}
1464
1465#[doc = "Time off types response"]
1466#[derive(
1467    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1468)]
1469pub struct ListTimeoffTypesResponse {
1470    #[serde(default, skip_serializing_if = "Option::is_none")]
1471    pub data: Option<ListTimeoffTypesResponseData>,
1472}
1473
1474impl std::fmt::Display for ListTimeoffTypesResponse {
1475    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1476        write!(
1477            f,
1478            "{}",
1479            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1480        )
1481    }
1482}
1483
1484#[cfg(feature = "tabled")]
1485impl tabled::Tabled for ListTimeoffTypesResponse {
1486    const LENGTH: usize = 1;
1487    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1488        vec![if let Some(data) = &self.data {
1489            format!("{:?}", data).into()
1490        } else {
1491            String::new().into()
1492        }]
1493    }
1494
1495    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1496        vec!["data".into()]
1497    }
1498}
1499
1500#[derive(
1501    serde :: Serialize,
1502    serde :: Deserialize,
1503    PartialEq,
1504    Hash,
1505    Debug,
1506    Clone,
1507    schemars :: JsonSchema,
1508    parse_display :: FromStr,
1509    parse_display :: Display,
1510)]
1511#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
1512#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
1513pub enum CreateApprovedTimeoffParamsStatus {
1514    #[serde(rename = "approved")]
1515    #[display("approved")]
1516    Approved,
1517}
1518
1519impl std::default::Default for CreateApprovedTimeoffParamsStatus {
1520    fn default() -> Self {
1521        CreateApprovedTimeoffParamsStatus::Approved
1522    }
1523}
1524
1525#[doc = "Approved timeoff creation params"]
1526#[derive(
1527    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1528)]
1529pub struct CreateApprovedTimeoffParams {
1530    #[doc = "Timeoff document params"]
1531    #[serde(default, skip_serializing_if = "Option::is_none")]
1532    pub document: Option<TimeoffDocumentParams>,
1533    pub employment_id: String,
1534    #[doc = "UTC date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format"]
1535    pub end_date: chrono::NaiveDate,
1536    #[serde(default, skip_serializing_if = "Option::is_none")]
1537    pub notes: Option<String>,
1538    #[doc = "UTC date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format"]
1539    pub start_date: chrono::NaiveDate,
1540    pub timeoff_days: Vec<TimeoffDaysParams>,
1541    pub timeoff_type: TimeoffType,
1542    pub timezone: String,
1543    #[doc = "UTC date time in YYYY-MM-DDTHH:mm:ss format"]
1544    #[serde(default, skip_serializing_if = "Option::is_none")]
1545    pub approved_at: Option<chrono::DateTime<chrono::Utc>>,
1546    #[serde(default, skip_serializing_if = "Option::is_none")]
1547    pub approver_id: Option<String>,
1548    #[serde(default, skip_serializing_if = "Option::is_none")]
1549    pub status: Option<CreateApprovedTimeoffParamsStatus>,
1550}
1551
1552impl std::fmt::Display for CreateApprovedTimeoffParams {
1553    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1554        write!(
1555            f,
1556            "{}",
1557            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1558        )
1559    }
1560}
1561
1562#[cfg(feature = "tabled")]
1563impl tabled::Tabled for CreateApprovedTimeoffParams {
1564    const LENGTH: usize = 11;
1565    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1566        vec![
1567            if let Some(document) = &self.document {
1568                format!("{:?}", document).into()
1569            } else {
1570                String::new().into()
1571            },
1572            self.employment_id.clone().into(),
1573            format!("{:?}", self.end_date).into(),
1574            if let Some(notes) = &self.notes {
1575                format!("{:?}", notes).into()
1576            } else {
1577                String::new().into()
1578            },
1579            format!("{:?}", self.start_date).into(),
1580            format!("{:?}", self.timeoff_days).into(),
1581            format!("{:?}", self.timeoff_type).into(),
1582            self.timezone.clone().into(),
1583            if let Some(approved_at) = &self.approved_at {
1584                format!("{:?}", approved_at).into()
1585            } else {
1586                String::new().into()
1587            },
1588            if let Some(approver_id) = &self.approver_id {
1589                format!("{:?}", approver_id).into()
1590            } else {
1591                String::new().into()
1592            },
1593            if let Some(status) = &self.status {
1594                format!("{:?}", status).into()
1595            } else {
1596                String::new().into()
1597            },
1598        ]
1599    }
1600
1601    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1602        vec![
1603            "document".into(),
1604            "employment_id".into(),
1605            "end_date".into(),
1606            "notes".into(),
1607            "start_date".into(),
1608            "timeoff_days".into(),
1609            "timeoff_type".into(),
1610            "timezone".into(),
1611            "approved_at".into(),
1612            "approver_id".into(),
1613            "status".into(),
1614        ]
1615    }
1616}
1617
1618#[derive(
1619    serde :: Serialize,
1620    serde :: Deserialize,
1621    PartialEq,
1622    Hash,
1623    Debug,
1624    Clone,
1625    schemars :: JsonSchema,
1626    parse_display :: FromStr,
1627    parse_display :: Display,
1628)]
1629#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
1630#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
1631pub enum EmploymentBasicParamsType {
1632    #[serde(rename = "employee")]
1633    #[display("employee")]
1634    Employee,
1635    #[serde(rename = "contractor")]
1636    #[display("contractor")]
1637    Contractor,
1638}
1639
1640#[doc = "Description of the required params to create an employment."]
1641#[derive(
1642    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1643)]
1644pub struct EmploymentBasicParams {
1645    pub company_id: String,
1646    #[serde(default, skip_serializing_if = "Option::is_none")]
1647    pub country_code: Option<String>,
1648    pub full_name: String,
1649    #[serde(default, skip_serializing_if = "Option::is_none")]
1650    pub job_title: Option<String>,
1651    pub personal_email: String,
1652    #[doc = "Required for employees, optional for contractors"]
1653    #[serde(default, skip_serializing_if = "Option::is_none")]
1654    pub provisional_start_date: Option<chrono::NaiveDate>,
1655    #[serde(rename = "type")]
1656    pub type_: EmploymentBasicParamsType,
1657}
1658
1659impl std::fmt::Display for EmploymentBasicParams {
1660    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1661        write!(
1662            f,
1663            "{}",
1664            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1665        )
1666    }
1667}
1668
1669#[cfg(feature = "tabled")]
1670impl tabled::Tabled for EmploymentBasicParams {
1671    const LENGTH: usize = 7;
1672    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1673        vec![
1674            self.company_id.clone().into(),
1675            format!("{:?}", self.country_code).into(),
1676            self.full_name.clone().into(),
1677            format!("{:?}", self.job_title).into(),
1678            self.personal_email.clone().into(),
1679            if let Some(provisional_start_date) = &self.provisional_start_date {
1680                format!("{:?}", provisional_start_date).into()
1681            } else {
1682                String::new().into()
1683            },
1684            format!("{:?}", self.type_).into(),
1685        ]
1686    }
1687
1688    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1689        vec![
1690            "company_id".into(),
1691            "country_code".into(),
1692            "full_name".into(),
1693            "job_title".into(),
1694            "personal_email".into(),
1695            "provisional_start_date".into(),
1696            "type_".into(),
1697        ]
1698    }
1699}
1700
1701#[doc = "Status of the payroll"]
1702#[derive(
1703    serde :: Serialize,
1704    serde :: Deserialize,
1705    PartialEq,
1706    Hash,
1707    Debug,
1708    Clone,
1709    schemars :: JsonSchema,
1710    parse_display :: FromStr,
1711    parse_display :: Display,
1712)]
1713#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
1714#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
1715pub enum PayrollRunWithLegalEntityStatus {
1716    #[serde(rename = "preparing")]
1717    #[display("preparing")]
1718    Preparing,
1719    #[serde(rename = "processing")]
1720    #[display("processing")]
1721    Processing,
1722    #[serde(rename = "waiting_for_customer_approval")]
1723    #[display("waiting_for_customer_approval")]
1724    WaitingForCustomerApproval,
1725    #[serde(rename = "completed")]
1726    #[display("completed")]
1727    Completed,
1728    #[serde(rename = "finalized")]
1729    #[display("finalized")]
1730    Finalized,
1731    #[serde(rename = "rejected")]
1732    #[display("rejected")]
1733    Rejected,
1734}
1735
1736#[derive(
1737    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1738)]
1739pub struct PayrollRunWithLegalEntity {
1740    #[serde(default, skip_serializing_if = "Option::is_none")]
1741    pub creator: Option<Creator>,
1742    #[doc = "Indicates if an Employer has completed the Payroll Inputs review flow"]
1743    #[serde(default, skip_serializing_if = "Option::is_none")]
1744    pub customer_inputs_reviewed: Option<bool>,
1745    #[serde(default, skip_serializing_if = "Option::is_none")]
1746    pub field_for_employment_matching: Option<String>,
1747    #[serde(default, skip_serializing_if = "Option::is_none")]
1748    pub inserted_at: Option<chrono::DateTime<chrono::Utc>>,
1749    #[serde(default, skip_serializing_if = "Option::is_none")]
1750    pub last_editor: Option<LastEditor>,
1751    pub legal_entity: RemoteEntity,
1752    #[serde(default, skip_serializing_if = "Option::is_none")]
1753    pub mapping_rules: Option<Vec<String>>,
1754    #[doc = "Name of the payroll_run to be displayed for users"]
1755    #[serde(default, skip_serializing_if = "Option::is_none")]
1756    pub name: Option<String>,
1757    #[serde(default, skip_serializing_if = "Option::is_none")]
1758    pub net_pay_extraction_expression: Option<String>,
1759    #[doc = "The end date the payroll run is for"]
1760    pub period_end: chrono::NaiveDate,
1761    #[doc = "The start date the payroll run is for"]
1762    pub period_start: chrono::NaiveDate,
1763    #[doc = "Payroll run product type"]
1764    #[serde(default, skip_serializing_if = "Option::is_none")]
1765    pub product_type: Option<ProductType>,
1766    pub slug: String,
1767    #[doc = "Status of the payroll"]
1768    pub status: PayrollRunWithLegalEntityStatus,
1769    pub summarize_automatically: bool,
1770    #[doc = "Payroll Run type"]
1771    #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
1772    pub type_: Option<Type>,
1773    #[serde(default, skip_serializing_if = "Option::is_none")]
1774    pub validations: Option<serde_json::Value>,
1775}
1776
1777impl std::fmt::Display for PayrollRunWithLegalEntity {
1778    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1779        write!(
1780            f,
1781            "{}",
1782            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1783        )
1784    }
1785}
1786
1787#[cfg(feature = "tabled")]
1788impl tabled::Tabled for PayrollRunWithLegalEntity {
1789    const LENGTH: usize = 17;
1790    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1791        vec![
1792            if let Some(creator) = &self.creator {
1793                format!("{:?}", creator).into()
1794            } else {
1795                String::new().into()
1796            },
1797            if let Some(customer_inputs_reviewed) = &self.customer_inputs_reviewed {
1798                format!("{:?}", customer_inputs_reviewed).into()
1799            } else {
1800                String::new().into()
1801            },
1802            if let Some(field_for_employment_matching) = &self.field_for_employment_matching {
1803                format!("{:?}", field_for_employment_matching).into()
1804            } else {
1805                String::new().into()
1806            },
1807            if let Some(inserted_at) = &self.inserted_at {
1808                format!("{:?}", inserted_at).into()
1809            } else {
1810                String::new().into()
1811            },
1812            if let Some(last_editor) = &self.last_editor {
1813                format!("{:?}", last_editor).into()
1814            } else {
1815                String::new().into()
1816            },
1817            format!("{:?}", self.legal_entity).into(),
1818            if let Some(mapping_rules) = &self.mapping_rules {
1819                format!("{:?}", mapping_rules).into()
1820            } else {
1821                String::new().into()
1822            },
1823            if let Some(name) = &self.name {
1824                format!("{:?}", name).into()
1825            } else {
1826                String::new().into()
1827            },
1828            if let Some(net_pay_extraction_expression) = &self.net_pay_extraction_expression {
1829                format!("{:?}", net_pay_extraction_expression).into()
1830            } else {
1831                String::new().into()
1832            },
1833            format!("{:?}", self.period_end).into(),
1834            format!("{:?}", self.period_start).into(),
1835            if let Some(product_type) = &self.product_type {
1836                format!("{:?}", product_type).into()
1837            } else {
1838                String::new().into()
1839            },
1840            self.slug.clone().into(),
1841            format!("{:?}", self.status).into(),
1842            format!("{:?}", self.summarize_automatically).into(),
1843            if let Some(type_) = &self.type_ {
1844                format!("{:?}", type_).into()
1845            } else {
1846                String::new().into()
1847            },
1848            if let Some(validations) = &self.validations {
1849                format!("{:?}", validations).into()
1850            } else {
1851                String::new().into()
1852            },
1853        ]
1854    }
1855
1856    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1857        vec![
1858            "creator".into(),
1859            "customer_inputs_reviewed".into(),
1860            "field_for_employment_matching".into(),
1861            "inserted_at".into(),
1862            "last_editor".into(),
1863            "legal_entity".into(),
1864            "mapping_rules".into(),
1865            "name".into(),
1866            "net_pay_extraction_expression".into(),
1867            "period_end".into(),
1868            "period_start".into(),
1869            "product_type".into(),
1870            "slug".into(),
1871            "status".into(),
1872            "summarize_automatically".into(),
1873            "type_".into(),
1874            "validations".into(),
1875        ]
1876    }
1877}
1878
1879#[doc = "Complete information of an employment"]
1880#[derive(
1881    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1882)]
1883pub struct EmploymentResponse {
1884    #[serde(default, skip_serializing_if = "Option::is_none")]
1885    pub data: Option<EmploymentData>,
1886}
1887
1888impl std::fmt::Display for EmploymentResponse {
1889    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1890        write!(
1891            f,
1892            "{}",
1893            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1894        )
1895    }
1896}
1897
1898#[cfg(feature = "tabled")]
1899impl tabled::Tabled for EmploymentResponse {
1900    const LENGTH: usize = 1;
1901    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1902        vec![if let Some(data) = &self.data {
1903            format!("{:?}", data).into()
1904        } else {
1905            String::new().into()
1906        }]
1907    }
1908
1909    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1910        vec!["data".into()]
1911    }
1912}
1913
1914#[derive(
1915    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1916)]
1917pub struct EmploymentData {
1918    #[doc = "Complete information of an employment"]
1919    #[serde(default, skip_serializing_if = "Option::is_none")]
1920    pub employment: Option<Employment>,
1921}
1922
1923impl std::fmt::Display for EmploymentData {
1924    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1925        write!(
1926            f,
1927            "{}",
1928            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1929        )
1930    }
1931}
1932
1933#[cfg(feature = "tabled")]
1934impl tabled::Tabled for EmploymentData {
1935    const LENGTH: usize = 1;
1936    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1937        vec![if let Some(employment) = &self.employment {
1938            format!("{:?}", employment).into()
1939        } else {
1940            String::new().into()
1941        }]
1942    }
1943
1944    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1945        vec!["employment".into()]
1946    }
1947}
1948
1949#[derive(
1950    serde :: Serialize,
1951    serde :: Deserialize,
1952    PartialEq,
1953    Hash,
1954    Debug,
1955    Clone,
1956    schemars :: JsonSchema,
1957    parse_display :: FromStr,
1958    parse_display :: Display,
1959)]
1960#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
1961#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
1962pub enum UpdateApprovedTimeoffParamsStatus {
1963    #[serde(rename = "approved")]
1964    #[display("approved")]
1965    Approved,
1966    #[serde(rename = "cancelled")]
1967    #[display("cancelled")]
1968    Cancelled,
1969}
1970
1971#[doc = "Update timeoff params"]
1972#[derive(
1973    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1974)]
1975pub struct UpdateApprovedTimeoffParams {
1976    #[doc = "UTC date time in YYYY-MM-DDTHH:mm:ss format"]
1977    #[serde(default, skip_serializing_if = "Option::is_none")]
1978    pub approved_at: Option<chrono::DateTime<chrono::Utc>>,
1979    #[serde(default, skip_serializing_if = "Option::is_none")]
1980    pub approver_id: Option<String>,
1981    #[doc = "The reason for cancelling a time off. Required when updating to status `cancelled`."]
1982    pub cancel_reason: String,
1983    #[doc = "Timeoff document params"]
1984    #[serde(default, skip_serializing_if = "Option::is_none")]
1985    pub document: Option<TimeoffDocumentParams>,
1986    #[doc = "The reason for the update. Required when updating the time off data but not changing \
1987             the status."]
1988    pub edit_reason: String,
1989    #[doc = "UTC date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format"]
1990    #[serde(default, skip_serializing_if = "Option::is_none")]
1991    pub end_date: Option<chrono::NaiveDate>,
1992    #[serde(default, skip_serializing_if = "Option::is_none")]
1993    pub notes: Option<String>,
1994    #[doc = "UTC date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format"]
1995    #[serde(default, skip_serializing_if = "Option::is_none")]
1996    pub start_date: Option<chrono::NaiveDate>,
1997    #[serde(default, skip_serializing_if = "Option::is_none")]
1998    pub status: Option<UpdateApprovedTimeoffParamsStatus>,
1999    #[serde(default, skip_serializing_if = "Option::is_none")]
2000    pub timeoff_days: Option<Vec<TimeoffDaysParams>>,
2001    #[serde(default, skip_serializing_if = "Option::is_none")]
2002    pub timeoff_type: Option<TimeoffType>,
2003    #[serde(default, skip_serializing_if = "Option::is_none")]
2004    pub timezone: Option<String>,
2005}
2006
2007impl std::fmt::Display for UpdateApprovedTimeoffParams {
2008    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2009        write!(
2010            f,
2011            "{}",
2012            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2013        )
2014    }
2015}
2016
2017#[cfg(feature = "tabled")]
2018impl tabled::Tabled for UpdateApprovedTimeoffParams {
2019    const LENGTH: usize = 12;
2020    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2021        vec![
2022            if let Some(approved_at) = &self.approved_at {
2023                format!("{:?}", approved_at).into()
2024            } else {
2025                String::new().into()
2026            },
2027            if let Some(approver_id) = &self.approver_id {
2028                format!("{:?}", approver_id).into()
2029            } else {
2030                String::new().into()
2031            },
2032            self.cancel_reason.clone().into(),
2033            if let Some(document) = &self.document {
2034                format!("{:?}", document).into()
2035            } else {
2036                String::new().into()
2037            },
2038            self.edit_reason.clone().into(),
2039            if let Some(end_date) = &self.end_date {
2040                format!("{:?}", end_date).into()
2041            } else {
2042                String::new().into()
2043            },
2044            if let Some(notes) = &self.notes {
2045                format!("{:?}", notes).into()
2046            } else {
2047                String::new().into()
2048            },
2049            if let Some(start_date) = &self.start_date {
2050                format!("{:?}", start_date).into()
2051            } else {
2052                String::new().into()
2053            },
2054            if let Some(status) = &self.status {
2055                format!("{:?}", status).into()
2056            } else {
2057                String::new().into()
2058            },
2059            if let Some(timeoff_days) = &self.timeoff_days {
2060                format!("{:?}", timeoff_days).into()
2061            } else {
2062                String::new().into()
2063            },
2064            if let Some(timeoff_type) = &self.timeoff_type {
2065                format!("{:?}", timeoff_type).into()
2066            } else {
2067                String::new().into()
2068            },
2069            if let Some(timezone) = &self.timezone {
2070                format!("{:?}", timezone).into()
2071            } else {
2072                String::new().into()
2073            },
2074        ]
2075    }
2076
2077    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2078        vec![
2079            "approved_at".into(),
2080            "approver_id".into(),
2081            "cancel_reason".into(),
2082            "document".into(),
2083            "edit_reason".into(),
2084            "end_date".into(),
2085            "notes".into(),
2086            "start_date".into(),
2087            "status".into(),
2088            "timeoff_days".into(),
2089            "timeoff_type".into(),
2090            "timezone".into(),
2091        ]
2092    }
2093}
2094
2095#[derive(
2096    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2097)]
2098pub struct AddressCountry {
2099    pub code: String,
2100    pub features: Vec<String>,
2101    pub name: String,
2102    pub slug: String,
2103}
2104
2105impl std::fmt::Display for AddressCountry {
2106    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2107        write!(
2108            f,
2109            "{}",
2110            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2111        )
2112    }
2113}
2114
2115#[cfg(feature = "tabled")]
2116impl tabled::Tabled for AddressCountry {
2117    const LENGTH: usize = 4;
2118    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2119        vec![
2120            self.code.clone().into(),
2121            format!("{:?}", self.features).into(),
2122            self.name.clone().into(),
2123            self.slug.clone().into(),
2124        ]
2125    }
2126
2127    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2128        vec![
2129            "code".into(),
2130            "features".into(),
2131            "name".into(),
2132            "slug".into(),
2133        ]
2134    }
2135}
2136
2137#[doc = "The status of employment"]
2138#[derive(
2139    serde :: Serialize,
2140    serde :: Deserialize,
2141    PartialEq,
2142    Hash,
2143    Debug,
2144    Clone,
2145    schemars :: JsonSchema,
2146    parse_display :: FromStr,
2147    parse_display :: Display,
2148)]
2149#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
2150#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
2151pub enum EmploymentStatus {
2152    #[serde(rename = "active")]
2153    #[display("active")]
2154    Active,
2155    #[serde(rename = "created")]
2156    #[display("created")]
2157    Created,
2158    #[serde(rename = "initiated")]
2159    #[display("initiated")]
2160    Initiated,
2161    #[serde(rename = "invited")]
2162    #[display("invited")]
2163    Invited,
2164    #[serde(rename = "pending")]
2165    #[display("pending")]
2166    Pending,
2167    #[serde(rename = "review")]
2168    #[display("review")]
2169    Review,
2170    #[serde(rename = "archived")]
2171    #[display("archived")]
2172    Archived,
2173    #[serde(rename = "deleted")]
2174    #[display("deleted")]
2175    Deleted,
2176}
2177
2178#[derive(
2179    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2180)]
2181pub struct UnprocessableEntityErrorResponse {
2182    pub errors: std::collections::HashMap<String, Vec<String>>,
2183}
2184
2185impl std::fmt::Display for UnprocessableEntityErrorResponse {
2186    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2187        write!(
2188            f,
2189            "{}",
2190            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2191        )
2192    }
2193}
2194
2195#[cfg(feature = "tabled")]
2196impl tabled::Tabled for UnprocessableEntityErrorResponse {
2197    const LENGTH: usize = 1;
2198    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2199        vec![format!("{:?}", self.errors).into()]
2200    }
2201
2202    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2203        vec!["errors".into()]
2204    }
2205}
2206
2207#[doc = "TimeoffDay schema"]
2208#[derive(
2209    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2210)]
2211pub struct TimeoffDay {
2212    #[doc = "UTC date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format"]
2213    pub day: chrono::NaiveDate,
2214    pub hours: i64,
2215    #[serde(default, skip_serializing_if = "Option::is_none")]
2216    pub payroll_run: Option<PayrollRunWithLegalEntity>,
2217}
2218
2219impl std::fmt::Display for TimeoffDay {
2220    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2221        write!(
2222            f,
2223            "{}",
2224            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2225        )
2226    }
2227}
2228
2229#[cfg(feature = "tabled")]
2230impl tabled::Tabled for TimeoffDay {
2231    const LENGTH: usize = 3;
2232    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2233        vec![
2234            format!("{:?}", self.day).into(),
2235            format!("{:?}", self.hours).into(),
2236            if let Some(payroll_run) = &self.payroll_run {
2237                format!("{:?}", payroll_run).into()
2238            } else {
2239                String::new().into()
2240            },
2241        ]
2242    }
2243
2244    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2245        vec!["day".into(), "hours".into(), "payroll_run".into()]
2246    }
2247}
2248
2249#[doc = "The status of the task"]
2250#[derive(
2251    serde :: Serialize,
2252    serde :: Deserialize,
2253    PartialEq,
2254    Hash,
2255    Debug,
2256    Clone,
2257    schemars :: JsonSchema,
2258    parse_display :: FromStr,
2259    parse_display :: Display,
2260)]
2261#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
2262#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
2263pub enum TaskStatus {
2264    #[serde(rename = "completed")]
2265    #[display("completed")]
2266    Completed,
2267    #[serde(rename = "pending")]
2268    #[display("pending")]
2269    Pending,
2270}
2271
2272#[doc = "Holidays response"]
2273#[derive(
2274    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2275)]
2276pub struct HolidaysResponse {
2277    #[serde(default, skip_serializing_if = "Option::is_none")]
2278    pub data: Option<Vec<Holiday>>,
2279}
2280
2281impl std::fmt::Display for HolidaysResponse {
2282    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2283        write!(
2284            f,
2285            "{}",
2286            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2287        )
2288    }
2289}
2290
2291#[cfg(feature = "tabled")]
2292impl tabled::Tabled for HolidaysResponse {
2293    const LENGTH: usize = 1;
2294    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2295        vec![if let Some(data) = &self.data {
2296            format!("{:?}", data).into()
2297        } else {
2298            String::new().into()
2299        }]
2300    }
2301
2302    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2303        vec!["data".into()]
2304    }
2305}
2306
2307#[doc = "Selected type of payment."]
2308#[derive(
2309    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2310)]
2311pub struct PricingPlanDetails {
2312    pub frequency: String,
2313}
2314
2315impl std::fmt::Display for PricingPlanDetails {
2316    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2317        write!(
2318            f,
2319            "{}",
2320            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2321        )
2322    }
2323}
2324
2325#[cfg(feature = "tabled")]
2326impl tabled::Tabled for PricingPlanDetails {
2327    const LENGTH: usize = 1;
2328    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2329        vec![self.frequency.clone().into()]
2330    }
2331
2332    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2333        vec!["frequency".into()]
2334    }
2335}
2336
2337#[derive(
2338    serde :: Serialize,
2339    serde :: Deserialize,
2340    PartialEq,
2341    Hash,
2342    Debug,
2343    Clone,
2344    schemars :: JsonSchema,
2345    parse_display :: FromStr,
2346    parse_display :: Display,
2347)]
2348#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
2349#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
2350pub enum TimeoffStatus {
2351    #[serde(rename = "approved")]
2352    #[display("approved")]
2353    Approved,
2354    #[serde(rename = "cancelled")]
2355    #[display("cancelled")]
2356    Cancelled,
2357    #[serde(rename = "declined")]
2358    #[display("declined")]
2359    Declined,
2360    #[serde(rename = "requested")]
2361    #[display("requested")]
2362    Requested,
2363    #[serde(rename = "taken")]
2364    #[display("taken")]
2365    Taken,
2366    #[serde(rename = "cancel_requested")]
2367    #[display("cancel_requested")]
2368    CancelRequested,
2369}
2370
2371#[derive(
2372    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2373)]
2374pub struct Timeoff {
2375    #[serde(
2376        default,
2377        skip_serializing_if = "Option::is_none",
2378        deserialize_with = "crate::utils::nullable_date_time_format::deserialize"
2379    )]
2380    pub approved_at: Option<chrono::DateTime<chrono::Utc>>,
2381    #[serde(default, skip_serializing_if = "Option::is_none")]
2382    pub approver_id: Option<String>,
2383    #[serde(default, skip_serializing_if = "Option::is_none")]
2384    pub cancel_reason: Option<String>,
2385    #[doc = "Optional UTC date time in YYYY-MM-DDTHH:mm:ss format"]
2386    #[serde(default, skip_serializing_if = "Option::is_none")]
2387    pub cancelled_at: Option<chrono::DateTime<chrono::Utc>>,
2388    #[doc = "A supported file"]
2389    #[serde(default, skip_serializing_if = "Option::is_none")]
2390    pub document: Option<File>,
2391    pub employment_id: String,
2392    pub end_date: chrono::NaiveDate,
2393    pub id: String,
2394    #[serde(default, skip_serializing_if = "Option::is_none")]
2395    pub notes: Option<String>,
2396    pub start_date: chrono::NaiveDate,
2397    pub status: TimeoffStatus,
2398    pub timeoff_days: Vec<TimeoffDay>,
2399    pub timeoff_type: TimeoffType,
2400    pub timezone: String,
2401}
2402
2403impl std::fmt::Display for Timeoff {
2404    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2405        write!(
2406            f,
2407            "{}",
2408            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2409        )
2410    }
2411}
2412
2413#[cfg(feature = "tabled")]
2414impl tabled::Tabled for Timeoff {
2415    const LENGTH: usize = 14;
2416    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2417        vec![
2418            if let Some(approved_at) = &self.approved_at {
2419                format!("{:?}", approved_at).into()
2420            } else {
2421                String::new().into()
2422            },
2423            if let Some(approver_id) = &self.approver_id {
2424                format!("{:?}", approver_id).into()
2425            } else {
2426                String::new().into()
2427            },
2428            if let Some(cancel_reason) = &self.cancel_reason {
2429                format!("{:?}", cancel_reason).into()
2430            } else {
2431                String::new().into()
2432            },
2433            if let Some(cancelled_at) = &self.cancelled_at {
2434                format!("{:?}", cancelled_at).into()
2435            } else {
2436                String::new().into()
2437            },
2438            if let Some(document) = &self.document {
2439                format!("{:?}", document).into()
2440            } else {
2441                String::new().into()
2442            },
2443            self.employment_id.clone().into(),
2444            format!("{:?}", self.end_date).into(),
2445            self.id.clone().into(),
2446            if let Some(notes) = &self.notes {
2447                format!("{:?}", notes).into()
2448            } else {
2449                String::new().into()
2450            },
2451            format!("{:?}", self.start_date).into(),
2452            format!("{:?}", self.status).into(),
2453            format!("{:?}", self.timeoff_days).into(),
2454            format!("{:?}", self.timeoff_type).into(),
2455            self.timezone.clone().into(),
2456        ]
2457    }
2458
2459    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2460        vec![
2461            "approved_at".into(),
2462            "approver_id".into(),
2463            "cancel_reason".into(),
2464            "cancelled_at".into(),
2465            "document".into(),
2466            "employment_id".into(),
2467            "end_date".into(),
2468            "id".into(),
2469            "notes".into(),
2470            "start_date".into(),
2471            "status".into(),
2472            "timeoff_days".into(),
2473            "timeoff_type".into(),
2474            "timezone".into(),
2475        ]
2476    }
2477}
2478
2479#[derive(
2480    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2481)]
2482pub struct CompanyManager {
2483    #[doc = "Company ID"]
2484    #[serde(default, skip_serializing_if = "Option::is_none")]
2485    pub company_id: Option<String>,
2486    #[doc = "Company Manager role."]
2487    #[serde(default, skip_serializing_if = "Option::is_none")]
2488    pub role: Option<String>,
2489    #[doc = "User Email"]
2490    #[serde(default, skip_serializing_if = "Option::is_none")]
2491    pub user_email: Option<String>,
2492    #[doc = "User ID"]
2493    #[serde(default, skip_serializing_if = "Option::is_none")]
2494    pub user_id: Option<String>,
2495    #[doc = "User's name"]
2496    #[serde(default, skip_serializing_if = "Option::is_none")]
2497    pub user_name: Option<String>,
2498}
2499
2500impl std::fmt::Display for CompanyManager {
2501    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2502        write!(
2503            f,
2504            "{}",
2505            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2506        )
2507    }
2508}
2509
2510#[cfg(feature = "tabled")]
2511impl tabled::Tabled for CompanyManager {
2512    const LENGTH: usize = 5;
2513    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2514        vec![
2515            if let Some(company_id) = &self.company_id {
2516                format!("{:?}", company_id).into()
2517            } else {
2518                String::new().into()
2519            },
2520            if let Some(role) = &self.role {
2521                format!("{:?}", role).into()
2522            } else {
2523                String::new().into()
2524            },
2525            if let Some(user_email) = &self.user_email {
2526                format!("{:?}", user_email).into()
2527            } else {
2528                String::new().into()
2529            },
2530            if let Some(user_id) = &self.user_id {
2531                format!("{:?}", user_id).into()
2532            } else {
2533                String::new().into()
2534            },
2535            if let Some(user_name) = &self.user_name {
2536                format!("{:?}", user_name).into()
2537            } else {
2538                String::new().into()
2539            },
2540        ]
2541    }
2542
2543    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2544        vec![
2545            "company_id".into(),
2546            "role".into(),
2547            "user_email".into(),
2548            "user_id".into(),
2549            "user_name".into(),
2550        ]
2551    }
2552}
2553
2554#[doc = "Timeoff document params"]
2555#[derive(
2556    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2557)]
2558pub struct TimeoffDocumentParams {
2559    #[doc = "The binary content of the file encoded with base64"]
2560    pub content: String,
2561    #[doc = "The file name of the document"]
2562    pub name: String,
2563}
2564
2565impl std::fmt::Display for TimeoffDocumentParams {
2566    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2567        write!(
2568            f,
2569            "{}",
2570            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2571        )
2572    }
2573}
2574
2575#[cfg(feature = "tabled")]
2576impl tabled::Tabled for TimeoffDocumentParams {
2577    const LENGTH: usize = 2;
2578    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2579        vec![self.content.clone().into(), self.name.clone().into()]
2580    }
2581
2582    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2583        vec!["content".into(), "name".into()]
2584    }
2585}
2586
2587#[derive(
2588    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2589)]
2590pub struct CompanyManagerParams {
2591    #[doc = "The Company ID. Required if the access token can access multiple companies. Optional \
2592             otherwise."]
2593    #[serde(default, skip_serializing_if = "Option::is_none")]
2594    pub company_id: Option<String>,
2595    #[doc = "The work email of the company manager"]
2596    pub email: String,
2597    #[doc = "The name of the company manager"]
2598    pub name: String,
2599    #[doc = "The role assigned for the new manager. The value should be one of the \
2600             following:\n\n- `admin`: an Admin can manage most of the resources in remote.\n- \
2601             `onboarding_manager`: an Onboarding Manager can add, see and manage new hires.\n- \
2602             `people_manager`: an People Manager can view the employee profiles for the team \
2603             members they manage and approve and decline time off and expenses for their \
2604             employees.\n"]
2605    pub role: String,
2606}
2607
2608impl std::fmt::Display for CompanyManagerParams {
2609    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2610        write!(
2611            f,
2612            "{}",
2613            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2614        )
2615    }
2616}
2617
2618#[cfg(feature = "tabled")]
2619impl tabled::Tabled for CompanyManagerParams {
2620    const LENGTH: usize = 4;
2621    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2622        vec![
2623            if let Some(company_id) = &self.company_id {
2624                format!("{:?}", company_id).into()
2625            } else {
2626                String::new().into()
2627            },
2628            self.email.clone().into(),
2629            self.name.clone().into(),
2630            self.role.clone().into(),
2631        ]
2632    }
2633
2634    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2635        vec![
2636            "company_id".into(),
2637            "email".into(),
2638            "name".into(),
2639            "role".into(),
2640        ]
2641    }
2642}
2643
2644#[derive(
2645    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2646)]
2647pub struct NotFoundResponse {
2648    #[serde(default, skip_serializing_if = "Option::is_none")]
2649    pub message: Option<String>,
2650}
2651
2652impl std::fmt::Display for NotFoundResponse {
2653    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2654        write!(
2655            f,
2656            "{}",
2657            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2658        )
2659    }
2660}
2661
2662#[cfg(feature = "tabled")]
2663impl tabled::Tabled for NotFoundResponse {
2664    const LENGTH: usize = 1;
2665    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2666        vec![if let Some(message) = &self.message {
2667            format!("{:?}", message).into()
2668        } else {
2669            String::new().into()
2670        }]
2671    }
2672
2673    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2674        vec!["message".into()]
2675    }
2676}
2677
2678#[doc = "A supported country on Remote"]
2679#[derive(
2680    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2681)]
2682pub struct Country {
2683    pub code: String,
2684    #[serde(default, skip_serializing_if = "Option::is_none")]
2685    pub country_subdivisions: Option<Vec<CountrySubdivision>>,
2686    pub name: String,
2687}
2688
2689impl std::fmt::Display for Country {
2690    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2691        write!(
2692            f,
2693            "{}",
2694            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2695        )
2696    }
2697}
2698
2699#[cfg(feature = "tabled")]
2700impl tabled::Tabled for Country {
2701    const LENGTH: usize = 3;
2702    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2703        vec![
2704            self.code.clone().into(),
2705            if let Some(country_subdivisions) = &self.country_subdivisions {
2706                format!("{:?}", country_subdivisions).into()
2707            } else {
2708                String::new().into()
2709            },
2710            self.name.clone().into(),
2711        ]
2712    }
2713
2714    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2715        vec!["code".into(), "country_subdivisions".into(), "name".into()]
2716    }
2717}
2718
2719#[doc = "Description of the basic required and onboarding tasks params to create an \
2720         employment.\nYou do not need to include all onboarding tasks when creating or updating an \
2721         employment.\n"]
2722#[derive(
2723    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2724)]
2725pub struct EmploymentFullParams {
2726    #[doc = "Home address information. As its properties may vary depending on the country,\nyou must query the [Show form schema](https://gateway.remote.com/eor/v1/docs/openapi.html#tag/Countries/operation/get_show_form_country) endpoint\npassing the country code and `address_details` as path parameters."]
2727    #[serde(default, skip_serializing_if = "Option::is_none")]
2728    pub address_details: Option<serde_json::Value>,
2729    #[doc = "Administrative information. As its properties may vary depending on the country,\nyou must query the [Show form schema](https://gateway.remote.com/eor/v1/docs/openapi.html#tag/Countries/operation/get_show_form_country) endpoint\npassing the country code and `administrative_details` as path parameters."]
2730    #[serde(default, skip_serializing_if = "Option::is_none")]
2731    pub administrative_details: Option<serde_json::Value>,
2732    #[doc = "Bank account information. As its properties may vary depending on the country,\nyou must query the [Show form schema](https://gateway.remote.com/eor/v1/docs/openapi.html#tag/Countries/operation/get_show_form_country) endpoint\npassing the country code and `bank_account_details` as path parameters."]
2733    #[serde(default, skip_serializing_if = "Option::is_none")]
2734    pub bank_account_details: Option<serde_json::Value>,
2735    #[doc = "Billing address information. As its properties may vary depending on the country,\nyou must query the [Show form schema](https://gateway.remote.com/eor/v1/docs/openapi.html#tag/Countries/operation/get_show_form_country) endpoint\npassing the country code and `billing_address_details` as path parameters."]
2736    #[serde(default, skip_serializing_if = "Option::is_none")]
2737    pub billing_address_details: Option<serde_json::Value>,
2738    pub company_id: String,
2739    #[doc = "Contract information. As its properties may vary depending on the country,\nyou must query the [Show form schema](https://gateway.remote.com/eor/v1/docs/openapi.html#tag/Countries/operation/get_show_form_country) endpoint\npassing the country code and `contract_details` as path parameters."]
2740    #[serde(default, skip_serializing_if = "Option::is_none")]
2741    pub contract_details: Option<serde_json::Value>,
2742    #[doc = "A supported country on Remote"]
2743    #[serde(default, skip_serializing_if = "Option::is_none")]
2744    pub country: Option<Country>,
2745    #[doc = "Emergency contact information. Its properties may vary depending on the country."]
2746    #[serde(default, skip_serializing_if = "Option::is_none")]
2747    pub emergency_contact_details: Option<serde_json::Value>,
2748    pub full_name: String,
2749    #[serde(default, skip_serializing_if = "Option::is_none")]
2750    pub job_title: Option<String>,
2751    #[doc = "The user id of the manager, who should have an `admin`, `owner` or `people_manager` \
2752             role.\nYou can find these users by querying the [Company Managers \
2753             endpoint](#operation/get_index_company_manager).\n**Update of this field is only \
2754             available for active employments.**\n"]
2755    #[serde(default, skip_serializing_if = "Option::is_none")]
2756    pub manager_id: Option<String>,
2757    #[doc = "Personal details information. As its properties may vary depending on the country,\nyou must query the [Show form schema](https://gateway.remote.com/eor/v1/docs/openapi.html#tag/Countries/operation/get_show_form_country) endpoint\npassing the country code and `personal_details` as path parameters."]
2758    #[serde(default, skip_serializing_if = "Option::is_none")]
2759    pub personal_details: Option<serde_json::Value>,
2760    pub personal_email: String,
2761    #[doc = "Selected type of payment."]
2762    #[serde(default, skip_serializing_if = "Option::is_none")]
2763    pub pricing_plan_details: Option<PricingPlanDetails>,
2764    #[doc = "Required for employees, optional for contractors"]
2765    #[serde(default, skip_serializing_if = "Option::is_none")]
2766    pub provisional_start_date: Option<chrono::NaiveDate>,
2767}
2768
2769impl std::fmt::Display for EmploymentFullParams {
2770    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2771        write!(
2772            f,
2773            "{}",
2774            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2775        )
2776    }
2777}
2778
2779#[cfg(feature = "tabled")]
2780impl tabled::Tabled for EmploymentFullParams {
2781    const LENGTH: usize = 15;
2782    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2783        vec![
2784            if let Some(address_details) = &self.address_details {
2785                format!("{:?}", address_details).into()
2786            } else {
2787                String::new().into()
2788            },
2789            if let Some(administrative_details) = &self.administrative_details {
2790                format!("{:?}", administrative_details).into()
2791            } else {
2792                String::new().into()
2793            },
2794            if let Some(bank_account_details) = &self.bank_account_details {
2795                format!("{:?}", bank_account_details).into()
2796            } else {
2797                String::new().into()
2798            },
2799            if let Some(billing_address_details) = &self.billing_address_details {
2800                format!("{:?}", billing_address_details).into()
2801            } else {
2802                String::new().into()
2803            },
2804            self.company_id.clone().into(),
2805            if let Some(contract_details) = &self.contract_details {
2806                format!("{:?}", contract_details).into()
2807            } else {
2808                String::new().into()
2809            },
2810            if let Some(country) = &self.country {
2811                format!("{:?}", country).into()
2812            } else {
2813                String::new().into()
2814            },
2815            if let Some(emergency_contact_details) = &self.emergency_contact_details {
2816                format!("{:?}", emergency_contact_details).into()
2817            } else {
2818                String::new().into()
2819            },
2820            self.full_name.clone().into(),
2821            format!("{:?}", self.job_title).into(),
2822            if let Some(manager_id) = &self.manager_id {
2823                format!("{:?}", manager_id).into()
2824            } else {
2825                String::new().into()
2826            },
2827            if let Some(personal_details) = &self.personal_details {
2828                format!("{:?}", personal_details).into()
2829            } else {
2830                String::new().into()
2831            },
2832            self.personal_email.clone().into(),
2833            if let Some(pricing_plan_details) = &self.pricing_plan_details {
2834                format!("{:?}", pricing_plan_details).into()
2835            } else {
2836                String::new().into()
2837            },
2838            if let Some(provisional_start_date) = &self.provisional_start_date {
2839                format!("{:?}", provisional_start_date).into()
2840            } else {
2841                String::new().into()
2842            },
2843        ]
2844    }
2845
2846    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2847        vec![
2848            "address_details".into(),
2849            "administrative_details".into(),
2850            "bank_account_details".into(),
2851            "billing_address_details".into(),
2852            "company_id".into(),
2853            "contract_details".into(),
2854            "country".into(),
2855            "emergency_contact_details".into(),
2856            "full_name".into(),
2857            "job_title".into(),
2858            "manager_id".into(),
2859            "personal_details".into(),
2860            "personal_email".into(),
2861            "pricing_plan_details".into(),
2862            "provisional_start_date".into(),
2863        ]
2864    }
2865}
2866
2867#[derive(
2868    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2869)]
2870pub struct MaybeMinimalCompany {
2871    #[serde(default, skip_serializing_if = "Option::is_none")]
2872    pub name: Option<String>,
2873    #[serde(default, skip_serializing_if = "Option::is_none")]
2874    pub slug: Option<String>,
2875}
2876
2877impl std::fmt::Display for MaybeMinimalCompany {
2878    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2879        write!(
2880            f,
2881            "{}",
2882            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2883        )
2884    }
2885}
2886
2887#[cfg(feature = "tabled")]
2888impl tabled::Tabled for MaybeMinimalCompany {
2889    const LENGTH: usize = 2;
2890    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2891        vec![
2892            if let Some(name) = &self.name {
2893                format!("{:?}", name).into()
2894            } else {
2895                String::new().into()
2896            },
2897            if let Some(slug) = &self.slug {
2898                format!("{:?}", slug).into()
2899            } else {
2900                String::new().into()
2901            },
2902        ]
2903    }
2904
2905    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2906        vec!["name".into(), "slug".into()]
2907    }
2908}
2909
2910#[derive(
2911    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2912)]
2913pub struct CompanyManagersResponseData {
2914    #[serde(default, skip_serializing_if = "Option::is_none")]
2915    pub company_managers: Option<Vec<CompanyManager>>,
2916    #[doc = "The current page among all of the total_pages"]
2917    #[serde(default, skip_serializing_if = "Option::is_none")]
2918    pub current_page: Option<i64>,
2919    #[doc = "The total number of records in the result"]
2920    #[serde(default, skip_serializing_if = "Option::is_none")]
2921    pub total_count: Option<i64>,
2922    #[doc = "The total number of pages the user can go through"]
2923    #[serde(default, skip_serializing_if = "Option::is_none")]
2924    pub total_pages: Option<i64>,
2925}
2926
2927impl std::fmt::Display for CompanyManagersResponseData {
2928    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2929        write!(
2930            f,
2931            "{}",
2932            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2933        )
2934    }
2935}
2936
2937#[cfg(feature = "tabled")]
2938impl tabled::Tabled for CompanyManagersResponseData {
2939    const LENGTH: usize = 4;
2940    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2941        vec![
2942            if let Some(company_managers) = &self.company_managers {
2943                format!("{:?}", company_managers).into()
2944            } else {
2945                String::new().into()
2946            },
2947            if let Some(current_page) = &self.current_page {
2948                format!("{:?}", current_page).into()
2949            } else {
2950                String::new().into()
2951            },
2952            if let Some(total_count) = &self.total_count {
2953                format!("{:?}", total_count).into()
2954            } else {
2955                String::new().into()
2956            },
2957            if let Some(total_pages) = &self.total_pages {
2958                format!("{:?}", total_pages).into()
2959            } else {
2960                String::new().into()
2961            },
2962        ]
2963    }
2964
2965    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2966        vec![
2967            "company_managers".into(),
2968            "current_page".into(),
2969            "total_count".into(),
2970            "total_pages".into(),
2971        ]
2972    }
2973}
2974
2975#[doc = "Response schema listing many company_managers"]
2976#[derive(
2977    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2978)]
2979pub struct CompanyManagersResponse {
2980    #[serde(default, skip_serializing_if = "Option::is_none")]
2981    pub data: Option<CompanyManagersResponseData>,
2982}
2983
2984impl std::fmt::Display for CompanyManagersResponse {
2985    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2986        write!(
2987            f,
2988            "{}",
2989            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2990        )
2991    }
2992}
2993
2994#[cfg(feature = "tabled")]
2995impl tabled::Tabled for CompanyManagersResponse {
2996    const LENGTH: usize = 1;
2997    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2998        vec![if let Some(data) = &self.data {
2999            format!("{:?}", data).into()
3000        } else {
3001            String::new().into()
3002        }]
3003    }
3004
3005    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3006        vec!["data".into()]
3007    }
3008}
3009
3010#[doc = "List of countries supported by Remote API"]
3011#[derive(
3012    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3013)]
3014pub struct CountriesResponse {
3015    #[serde(default, skip_serializing_if = "Option::is_none")]
3016    pub data: Option<Vec<Country>>,
3017}
3018
3019impl std::fmt::Display for CountriesResponse {
3020    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3021        write!(
3022            f,
3023            "{}",
3024            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3025        )
3026    }
3027}
3028
3029#[cfg(feature = "tabled")]
3030impl tabled::Tabled for CountriesResponse {
3031    const LENGTH: usize = 1;
3032    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3033        vec![if let Some(data) = &self.data {
3034            format!("{:?}", data).into()
3035        } else {
3036            String::new().into()
3037        }]
3038    }
3039
3040    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3041        vec!["data".into()]
3042    }
3043}
3044
3045#[derive(
3046    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3047)]
3048pub struct CompanyManagerCreatedResponse {
3049    #[serde(default, skip_serializing_if = "Option::is_none")]
3050    pub company_manager: Option<CompanyManager>,
3051}
3052
3053impl std::fmt::Display for CompanyManagerCreatedResponse {
3054    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3055        write!(
3056            f,
3057            "{}",
3058            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3059        )
3060    }
3061}
3062
3063#[cfg(feature = "tabled")]
3064impl tabled::Tabled for CompanyManagerCreatedResponse {
3065    const LENGTH: usize = 1;
3066    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3067        vec![if let Some(company_manager) = &self.company_manager {
3068            format!("{:?}", company_manager).into()
3069        } else {
3070            String::new().into()
3071        }]
3072    }
3073
3074    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3075        vec!["company_manager".into()]
3076    }
3077}
3078
3079#[derive(
3080    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3081)]
3082pub struct RemoteEntity {
3083    pub address: Address,
3084    #[serde(default, skip_serializing_if = "Option::is_none")]
3085    pub company: Option<MaybeMinimalCompany>,
3086    #[doc = "Identifies if the legal entity is owned by Remote"]
3087    #[serde(default, skip_serializing_if = "Option::is_none")]
3088    pub is_internal: Option<bool>,
3089    pub name: String,
3090    pub slug: String,
3091}
3092
3093impl std::fmt::Display for RemoteEntity {
3094    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3095        write!(
3096            f,
3097            "{}",
3098            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3099        )
3100    }
3101}
3102
3103#[cfg(feature = "tabled")]
3104impl tabled::Tabled for RemoteEntity {
3105    const LENGTH: usize = 5;
3106    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3107        vec![
3108            format!("{:?}", self.address).into(),
3109            format!("{:?}", self.company).into(),
3110            if let Some(is_internal) = &self.is_internal {
3111                format!("{:?}", is_internal).into()
3112            } else {
3113                String::new().into()
3114            },
3115            self.name.clone().into(),
3116            self.slug.clone().into(),
3117        ]
3118    }
3119
3120    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3121        vec![
3122            "address".into(),
3123            "company".into(),
3124            "is_internal".into(),
3125            "name".into(),
3126            "slug".into(),
3127        ]
3128    }
3129}
3130
3131#[doc = "Object with required and optional fields, its descriptions and suggested presentation"]
3132#[derive(
3133    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3134)]
3135pub struct CountryFormResponse {
3136    #[serde(default, skip_serializing_if = "Option::is_none")]
3137    pub data: Option<Data>,
3138}
3139
3140impl std::fmt::Display for CountryFormResponse {
3141    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3142        write!(
3143            f,
3144            "{}",
3145            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3146        )
3147    }
3148}
3149
3150#[cfg(feature = "tabled")]
3151impl tabled::Tabled for CountryFormResponse {
3152    const LENGTH: usize = 1;
3153    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3154        vec![if let Some(data) = &self.data {
3155            format!("{:?}", data).into()
3156        } else {
3157            String::new().into()
3158        }]
3159    }
3160
3161    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3162        vec!["data".into()]
3163    }
3164}
3165
3166#[derive(
3167    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3168)]
3169pub struct MinimalCompany {
3170    pub name: String,
3171    pub slug: String,
3172}
3173
3174impl std::fmt::Display for MinimalCompany {
3175    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3176        write!(
3177            f,
3178            "{}",
3179            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3180        )
3181    }
3182}
3183
3184#[cfg(feature = "tabled")]
3185impl tabled::Tabled for MinimalCompany {
3186    const LENGTH: usize = 2;
3187    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3188        vec![self.name.clone().into(), self.slug.clone().into()]
3189    }
3190
3191    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3192        vec!["name".into(), "slug".into()]
3193    }
3194}
3195
3196#[derive(
3197    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3198)]
3199pub enum UnprocessableEntityResponse {
3200    Errors {},
3201}
3202
3203#[derive(
3204    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3205)]
3206pub struct TooManyRequestsResponse {
3207    #[serde(default, skip_serializing_if = "Option::is_none")]
3208    pub message: Option<String>,
3209}
3210
3211impl std::fmt::Display for TooManyRequestsResponse {
3212    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3213        write!(
3214            f,
3215            "{}",
3216            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3217        )
3218    }
3219}
3220
3221#[cfg(feature = "tabled")]
3222impl tabled::Tabled for TooManyRequestsResponse {
3223    const LENGTH: usize = 1;
3224    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3225        vec![if let Some(message) = &self.message {
3226            format!("{:?}", message).into()
3227        } else {
3228            String::new().into()
3229        }]
3230    }
3231
3232    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3233        vec!["message".into()]
3234    }
3235}
3236
3237#[derive(
3238    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3239)]
3240pub struct Holiday {
3241    pub day: chrono::NaiveDate,
3242    pub name: String,
3243    #[serde(default, skip_serializing_if = "Option::is_none")]
3244    pub note: Option<String>,
3245}
3246
3247impl std::fmt::Display for Holiday {
3248    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3249        write!(
3250            f,
3251            "{}",
3252            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3253        )
3254    }
3255}
3256
3257#[cfg(feature = "tabled")]
3258impl tabled::Tabled for Holiday {
3259    const LENGTH: usize = 3;
3260    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3261        vec![
3262            format!("{:?}", self.day).into(),
3263            self.name.clone().into(),
3264            if let Some(note) = &self.note {
3265                format!("{:?}", note).into()
3266            } else {
3267                String::new().into()
3268            },
3269        ]
3270    }
3271
3272    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3273        vec!["day".into(), "name".into(), "note".into()]
3274    }
3275}
3276
3277#[derive(
3278    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3279)]
3280pub struct BadRequestResponse {
3281    #[serde(default, skip_serializing_if = "Option::is_none")]
3282    pub message: Option<String>,
3283}
3284
3285impl std::fmt::Display for BadRequestResponse {
3286    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3287        write!(
3288            f,
3289            "{}",
3290            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3291        )
3292    }
3293}
3294
3295#[cfg(feature = "tabled")]
3296impl tabled::Tabled for BadRequestResponse {
3297    const LENGTH: usize = 1;
3298    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3299        vec![if let Some(message) = &self.message {
3300            format!("{:?}", message).into()
3301        } else {
3302            String::new().into()
3303        }]
3304    }
3305
3306    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3307        vec!["message".into()]
3308    }
3309}
3310
3311#[derive(
3312    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3313)]
3314pub struct UnauthorizedResponse {
3315    pub message: String,
3316}
3317
3318impl std::fmt::Display for UnauthorizedResponse {
3319    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3320        write!(
3321            f,
3322            "{}",
3323            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3324        )
3325    }
3326}
3327
3328#[cfg(feature = "tabled")]
3329impl tabled::Tabled for UnauthorizedResponse {
3330    const LENGTH: usize = 1;
3331    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3332        vec![self.message.clone().into()]
3333    }
3334
3335    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3336        vec!["message".into()]
3337    }
3338}
3339
3340#[doc = "A subdivision of a supported country on Remote"]
3341#[derive(
3342    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3343)]
3344pub struct CountrySubdivision {
3345    #[serde(default, skip_serializing_if = "Option::is_none")]
3346    pub code: Option<String>,
3347    pub name: String,
3348    #[serde(default, skip_serializing_if = "Option::is_none")]
3349    pub subdivision_type: Option<String>,
3350}
3351
3352impl std::fmt::Display for CountrySubdivision {
3353    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3354        write!(
3355            f,
3356            "{}",
3357            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3358        )
3359    }
3360}
3361
3362#[cfg(feature = "tabled")]
3363impl tabled::Tabled for CountrySubdivision {
3364    const LENGTH: usize = 3;
3365    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3366        vec![
3367            if let Some(code) = &self.code {
3368                format!("{:?}", code).into()
3369            } else {
3370                String::new().into()
3371            },
3372            self.name.clone().into(),
3373            if let Some(subdivision_type) = &self.subdivision_type {
3374                format!("{:?}", subdivision_type).into()
3375            } else {
3376                String::new().into()
3377            },
3378        ]
3379    }
3380
3381    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3382        vec!["code".into(), "name".into(), "subdivision_type".into()]
3383    }
3384}
3385
3386#[doc = "Timeoff creation params"]
3387#[derive(
3388    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3389)]
3390pub struct CreateTimeoffParams {
3391    #[doc = "Timeoff document params"]
3392    #[serde(default, skip_serializing_if = "Option::is_none")]
3393    pub document: Option<TimeoffDocumentParams>,
3394    pub employment_id: String,
3395    #[doc = "UTC date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format"]
3396    pub end_date: chrono::NaiveDate,
3397    #[serde(default, skip_serializing_if = "Option::is_none")]
3398    pub notes: Option<String>,
3399    #[doc = "UTC date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format"]
3400    pub start_date: chrono::NaiveDate,
3401    pub timeoff_days: Vec<TimeoffDaysParams>,
3402    pub timeoff_type: TimeoffType,
3403    pub timezone: String,
3404}
3405
3406impl std::fmt::Display for CreateTimeoffParams {
3407    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3408        write!(
3409            f,
3410            "{}",
3411            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3412        )
3413    }
3414}
3415
3416#[cfg(feature = "tabled")]
3417impl tabled::Tabled for CreateTimeoffParams {
3418    const LENGTH: usize = 8;
3419    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3420        vec![
3421            if let Some(document) = &self.document {
3422                format!("{:?}", document).into()
3423            } else {
3424                String::new().into()
3425            },
3426            self.employment_id.clone().into(),
3427            format!("{:?}", self.end_date).into(),
3428            if let Some(notes) = &self.notes {
3429                format!("{:?}", notes).into()
3430            } else {
3431                String::new().into()
3432            },
3433            format!("{:?}", self.start_date).into(),
3434            format!("{:?}", self.timeoff_days).into(),
3435            format!("{:?}", self.timeoff_type).into(),
3436            self.timezone.clone().into(),
3437        ]
3438    }
3439
3440    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3441        vec![
3442            "document".into(),
3443            "employment_id".into(),
3444            "end_date".into(),
3445            "notes".into(),
3446            "start_date".into(),
3447            "timeoff_days".into(),
3448            "timeoff_type".into(),
3449            "timezone".into(),
3450        ]
3451    }
3452}
3453
3454#[doc = "Timeoff days params"]
3455#[derive(
3456    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3457)]
3458pub struct TimeoffDaysParams {
3459    #[doc = "UTC date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format"]
3460    #[serde(default, skip_serializing_if = "Option::is_none")]
3461    pub day: Option<chrono::NaiveDate>,
3462    #[serde(default, skip_serializing_if = "Option::is_none")]
3463    pub hours: Option<i64>,
3464}
3465
3466impl std::fmt::Display for TimeoffDaysParams {
3467    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3468        write!(
3469            f,
3470            "{}",
3471            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3472        )
3473    }
3474}
3475
3476#[cfg(feature = "tabled")]
3477impl tabled::Tabled for TimeoffDaysParams {
3478    const LENGTH: usize = 2;
3479    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3480        vec![
3481            if let Some(day) = &self.day {
3482                format!("{:?}", day).into()
3483            } else {
3484                String::new().into()
3485            },
3486            if let Some(hours) = &self.hours {
3487                format!("{:?}", hours).into()
3488            } else {
3489                String::new().into()
3490            },
3491        ]
3492    }
3493
3494    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3495        vec!["day".into(), "hours".into()]
3496    }
3497}
3498
3499#[doc = "All tasks that need to be completed before marking the employment as ready"]
3500#[derive(
3501    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3502)]
3503pub struct OnboardingTasks {
3504    #[doc = "Description and status of an onboarding task."]
3505    #[serde(default, skip_serializing_if = "Option::is_none")]
3506    pub address_details: Option<TaskDescription>,
3507    #[doc = "Description and status of an onboarding task."]
3508    #[serde(default, skip_serializing_if = "Option::is_none")]
3509    pub administrative_details: Option<TaskDescription>,
3510    #[doc = "Description and status of an onboarding task."]
3511    #[serde(default, skip_serializing_if = "Option::is_none")]
3512    pub bank_account_details: Option<TaskDescription>,
3513    #[doc = "Description and status of an onboarding task."]
3514    #[serde(default, skip_serializing_if = "Option::is_none")]
3515    pub billing_address_details: Option<TaskDescription>,
3516    #[doc = "Description and status of an onboarding task."]
3517    #[serde(default, skip_serializing_if = "Option::is_none")]
3518    pub contract_details: Option<TaskDescription>,
3519    #[doc = "Description and status of an onboarding task."]
3520    #[serde(default, skip_serializing_if = "Option::is_none")]
3521    pub emergency_contact_details: Option<TaskDescription>,
3522    #[doc = "Description and status of an onboarding task."]
3523    #[serde(default, skip_serializing_if = "Option::is_none")]
3524    pub employment_document_details: Option<TaskDescription>,
3525    #[doc = "Description and status of an onboarding task."]
3526    #[serde(default, skip_serializing_if = "Option::is_none")]
3527    pub personal_details: Option<TaskDescription>,
3528    #[doc = "Description and status of an onboarding task."]
3529    #[serde(default, skip_serializing_if = "Option::is_none")]
3530    pub pricing_plan_details: Option<TaskDescription>,
3531}
3532
3533impl std::fmt::Display for OnboardingTasks {
3534    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3535        write!(
3536            f,
3537            "{}",
3538            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3539        )
3540    }
3541}
3542
3543#[cfg(feature = "tabled")]
3544impl tabled::Tabled for OnboardingTasks {
3545    const LENGTH: usize = 9;
3546    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3547        vec![
3548            format!("{:?}", self.address_details).into(),
3549            format!("{:?}", self.administrative_details).into(),
3550            format!("{:?}", self.bank_account_details).into(),
3551            format!("{:?}", self.billing_address_details).into(),
3552            format!("{:?}", self.contract_details).into(),
3553            format!("{:?}", self.emergency_contact_details).into(),
3554            format!("{:?}", self.employment_document_details).into(),
3555            format!("{:?}", self.personal_details).into(),
3556            format!("{:?}", self.pricing_plan_details).into(),
3557        ]
3558    }
3559
3560    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3561        vec![
3562            "address_details".into(),
3563            "administrative_details".into(),
3564            "bank_account_details".into(),
3565            "billing_address_details".into(),
3566            "contract_details".into(),
3567            "emergency_contact_details".into(),
3568            "employment_document_details".into(),
3569            "personal_details".into(),
3570            "pricing_plan_details".into(),
3571        ]
3572    }
3573}
3574
3575#[derive(
3576    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3577)]
3578pub struct ListTimeoffResponseData {
3579    #[doc = "The current page among all of the total_pages"]
3580    #[serde(default, skip_serializing_if = "Option::is_none")]
3581    pub current_page: Option<i64>,
3582    #[serde(default, skip_serializing_if = "Option::is_none")]
3583    pub timeoffs: Option<Vec<Timeoff>>,
3584    #[doc = "The total number of records in the result"]
3585    #[serde(default, skip_serializing_if = "Option::is_none")]
3586    pub total_count: Option<i64>,
3587    #[doc = "The total number of pages the user can go through"]
3588    #[serde(default, skip_serializing_if = "Option::is_none")]
3589    pub total_pages: Option<i64>,
3590}
3591
3592impl std::fmt::Display for ListTimeoffResponseData {
3593    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3594        write!(
3595            f,
3596            "{}",
3597            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3598        )
3599    }
3600}
3601
3602#[cfg(feature = "tabled")]
3603impl tabled::Tabled for ListTimeoffResponseData {
3604    const LENGTH: usize = 4;
3605    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3606        vec![
3607            if let Some(current_page) = &self.current_page {
3608                format!("{:?}", current_page).into()
3609            } else {
3610                String::new().into()
3611            },
3612            if let Some(timeoffs) = &self.timeoffs {
3613                format!("{:?}", timeoffs).into()
3614            } else {
3615                String::new().into()
3616            },
3617            if let Some(total_count) = &self.total_count {
3618                format!("{:?}", total_count).into()
3619            } else {
3620                String::new().into()
3621            },
3622            if let Some(total_pages) = &self.total_pages {
3623                format!("{:?}", total_pages).into()
3624            } else {
3625                String::new().into()
3626            },
3627        ]
3628    }
3629
3630    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3631        vec![
3632            "current_page".into(),
3633            "timeoffs".into(),
3634            "total_count".into(),
3635            "total_pages".into(),
3636        ]
3637    }
3638}
3639
3640#[doc = "Response schema listing many timeoffs"]
3641#[derive(
3642    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3643)]
3644pub struct ListTimeoffResponse {
3645    #[serde(default, skip_serializing_if = "Option::is_none")]
3646    pub data: Option<ListTimeoffResponseData>,
3647}
3648
3649impl std::fmt::Display for ListTimeoffResponse {
3650    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3651        write!(
3652            f,
3653            "{}",
3654            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3655        )
3656    }
3657}
3658
3659#[cfg(feature = "tabled")]
3660impl tabled::Tabled for ListTimeoffResponse {
3661    const LENGTH: usize = 1;
3662    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3663        vec![if let Some(data) = &self.data {
3664            format!("{:?}", data).into()
3665        } else {
3666            String::new().into()
3667        }]
3668    }
3669
3670    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3671        vec!["data".into()]
3672    }
3673}
3674
3675#[doc = "Required params to update an employment in the Sandbox environment.\n\nCurrently only \
3676         supports setting the Employment Status to `active`.\n"]
3677#[derive(
3678    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3679)]
3680pub struct EmploymentUpdateParams {
3681    #[doc = "The status of employment"]
3682    #[serde(default, skip_serializing_if = "Option::is_none")]
3683    pub status: Option<EmploymentStatus>,
3684}
3685
3686impl std::fmt::Display for EmploymentUpdateParams {
3687    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3688        write!(
3689            f,
3690            "{}",
3691            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3692        )
3693    }
3694}
3695
3696#[cfg(feature = "tabled")]
3697impl tabled::Tabled for EmploymentUpdateParams {
3698    const LENGTH: usize = 1;
3699    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3700        vec![if let Some(status) = &self.status {
3701            format!("{:?}", status).into()
3702        } else {
3703            String::new().into()
3704        }]
3705    }
3706
3707    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3708        vec!["status".into()]
3709    }
3710}
3711
3712#[doc = "Minimal information of an employment."]
3713#[derive(
3714    serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3715)]
3716pub struct MinimalEmployment {
3717    #[doc = "A supported country on Remote"]
3718    pub country: Country,
3719    pub full_name: String,
3720    pub id: String,
3721    #[serde(default, skip_serializing_if = "Option::is_none")]
3722    pub job_title: Option<String>,
3723    #[doc = "The status of employment"]
3724    pub status: EmploymentStatus,
3725}
3726
3727impl std::fmt::Display for MinimalEmployment {
3728    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3729        write!(
3730            f,
3731            "{}",
3732            serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3733        )
3734    }
3735}
3736
3737#[cfg(feature = "tabled")]
3738impl tabled::Tabled for MinimalEmployment {
3739    const LENGTH: usize = 5;
3740    fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3741        vec![
3742            format!("{:?}", self.country).into(),
3743            self.full_name.clone().into(),
3744            self.id.clone().into(),
3745            format!("{:?}", self.job_title).into(),
3746            format!("{:?}", self.status).into(),
3747        ]
3748    }
3749
3750    fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3751        vec![
3752            "country".into(),
3753            "full_name".into(),
3754            "id".into(),
3755            "job_title".into(),
3756            "status".into(),
3757        ]
3758    }
3759}
3760
3761#[derive(
3762    serde :: Serialize,
3763    serde :: Deserialize,
3764    PartialEq,
3765    Hash,
3766    Debug,
3767    Clone,
3768    schemars :: JsonSchema,
3769    parse_display :: FromStr,
3770    parse_display :: Display,
3771)]
3772#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
3773#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
3774pub enum OrderBy {
3775    #[serde(rename = "asc")]
3776    #[display("asc")]
3777    Asc,
3778    #[serde(rename = "desc")]
3779    #[display("desc")]
3780    Desc,
3781}
3782
3783#[derive(
3784    serde :: Serialize,
3785    serde :: Deserialize,
3786    PartialEq,
3787    Hash,
3788    Debug,
3789    Clone,
3790    schemars :: JsonSchema,
3791    parse_display :: FromStr,
3792    parse_display :: Display,
3793)]
3794#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
3795#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
3796pub enum SortBy {
3797    #[serde(rename = "timeoff_type")]
3798    #[display("timeoff_type")]
3799    TimeoffType,
3800    #[serde(rename = "status")]
3801    #[display("status")]
3802    Status,
3803}
3804
3805#[derive(
3806    serde :: Serialize,
3807    serde :: Deserialize,
3808    PartialEq,
3809    Hash,
3810    Debug,
3811    Clone,
3812    schemars :: JsonSchema,
3813    parse_display :: FromStr,
3814    parse_display :: Display,
3815)]
3816#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
3817#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
3818pub enum GetIndexTimeoffStatus {
3819    #[serde(rename = "approved")]
3820    #[display("approved")]
3821    Approved,
3822    #[serde(rename = "cancelled")]
3823    #[display("cancelled")]
3824    Cancelled,
3825    #[serde(rename = "declined")]
3826    #[display("declined")]
3827    Declined,
3828    #[serde(rename = "requested")]
3829    #[display("requested")]
3830    Requested,
3831    #[serde(rename = "taken")]
3832    #[display("taken")]
3833    Taken,
3834    #[serde(rename = "cancel_requested")]
3835    #[display("cancel_requested")]
3836    CancelRequested,
3837}