Skip to main content

netbox_openapi/models/
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.6.2 (4.6)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// CustomFieldChoiceSetRequest : Adds an `owner` field for models which have a ForeignKey to users.Owner.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct CustomFieldChoiceSetRequest {
15    #[serde(rename = "name")]
16    pub name: String,
17    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
18    pub description: Option<String>,
19    /// * `IATA` - IATA (Airport codes) * `ISO_3166` - ISO 3166 (Country codes) * `UN_LOCODE` - UN/LOCODE (Location codes)
20    #[serde(rename = "base_choices", skip_serializing_if = "Option::is_none")]
21    pub base_choices: Option<BaseChoices>,
22    #[serde(rename = "extra_choices")]
23    pub extra_choices: Vec<Vec<serde_json::Value>>,
24    #[serde(rename = "choice_colors", skip_serializing_if = "Option::is_none")]
25    pub choice_colors: Option<ChoiceColors>,
26    /// Choices are automatically ordered alphabetically
27    #[serde(
28        rename = "order_alphabetically",
29        skip_serializing_if = "Option::is_none"
30    )]
31    pub order_alphabetically: Option<bool>,
32    #[serde(
33        rename = "owner",
34        default,
35        with = "::serde_with::rust::double_option",
36        skip_serializing_if = "Option::is_none"
37    )]
38    pub owner: Option<Option<Box<crate::models::AsnRangeRequestOwner>>>,
39}
40
41impl CustomFieldChoiceSetRequest {
42    /// Adds an `owner` field for models which have a ForeignKey to users.Owner.
43    pub fn new(
44        name: String,
45        extra_choices: Vec<Vec<serde_json::Value>>,
46    ) -> CustomFieldChoiceSetRequest {
47        CustomFieldChoiceSetRequest {
48            name,
49            description: None,
50            base_choices: None,
51            extra_choices,
52            choice_colors: None,
53            order_alphabetically: None,
54            owner: None,
55        }
56    }
57}
58
59/// * `IATA` - IATA (Airport codes) * `ISO_3166` - ISO 3166 (Country codes) * `UN_LOCODE` - UN/LOCODE (Location codes)
60#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
61pub enum BaseChoices {
62    #[serde(rename = "IATA")]
63    Iata,
64    #[serde(rename = "ISO_3166")]
65    Iso3166,
66    #[serde(rename = "UN_LOCODE")]
67    UnLocode,
68}
69
70impl Default for BaseChoices {
71    fn default() -> BaseChoices {
72        Self::Iata
73    }
74}
75///
76#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
77pub enum ChoiceColors {
78    #[serde(rename = "blue")]
79    Blue,
80    #[serde(rename = "indigo")]
81    Indigo,
82    #[serde(rename = "purple")]
83    Purple,
84    #[serde(rename = "pink")]
85    Pink,
86    #[serde(rename = "red")]
87    Red,
88    #[serde(rename = "orange")]
89    Orange,
90    #[serde(rename = "yellow")]
91    Yellow,
92    #[serde(rename = "green")]
93    Green,
94    #[serde(rename = "teal")]
95    Teal,
96    #[serde(rename = "cyan")]
97    Cyan,
98    #[serde(rename = "gray")]
99    Gray,
100    #[serde(rename = "black")]
101    Black,
102    #[serde(rename = "white")]
103    White,
104}
105
106impl Default for ChoiceColors {
107    fn default() -> ChoiceColors {
108        Self::Blue
109    }
110}