netbox_openapi/models/
patched_writable_custom_field_choice_set_request.rs

1/*
2 * NetBox REST API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 4.4.2-Docker-3.4.1 (4.4)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// PatchedWritableCustomFieldChoiceSetRequest : Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see <https://github.com/encode/django-rest-framework/issues/3144>)
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct PatchedWritableCustomFieldChoiceSetRequest {
15    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
16    pub name: Option<String>,
17    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
18    pub description: Option<String>,
19    /// Base set of predefined choices (optional)  * `IATA` - IATA (Airport codes) * `ISO_3166` - ISO 3166 (Country codes) * `UN_LOCODE` - UN/LOCODE (Location codes)
20    #[serde(
21        rename = "base_choices",
22        default,
23        with = "::serde_with::rust::double_option",
24        skip_serializing_if = "Option::is_none"
25    )]
26    pub base_choices: Option<Option<BaseChoices>>,
27    #[serde(rename = "extra_choices", skip_serializing_if = "Option::is_none")]
28    pub extra_choices: Option<Vec<Vec<serde_json::Value>>>,
29    /// Choices are automatically ordered alphabetically
30    #[serde(
31        rename = "order_alphabetically",
32        skip_serializing_if = "Option::is_none"
33    )]
34    pub order_alphabetically: Option<bool>,
35}
36
37impl PatchedWritableCustomFieldChoiceSetRequest {
38    /// Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see <https://github.com/encode/django-rest-framework/issues/3144>)
39    pub fn new() -> PatchedWritableCustomFieldChoiceSetRequest {
40        PatchedWritableCustomFieldChoiceSetRequest {
41            name: None,
42            description: None,
43            base_choices: None,
44            extra_choices: None,
45            order_alphabetically: None,
46        }
47    }
48}
49
50/// Base set of predefined choices (optional)  * `IATA` - IATA (Airport codes) * `ISO_3166` - ISO 3166 (Country codes) * `UN_LOCODE` - UN/LOCODE (Location codes)
51#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
52pub enum BaseChoices {
53    #[serde(rename = "IATA")]
54    Iata,
55    #[serde(rename = "ISO_3166")]
56    Iso3166,
57    #[serde(rename = "UN_LOCODE")]
58    UnLocode,
59    #[serde(rename = "")]
60    Empty,
61    #[serde(rename = "null")]
62    Null,
63}
64
65impl Default for BaseChoices {
66    fn default() -> BaseChoices {
67        Self::Iata
68    }
69}