Skip to main content

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