Skip to main content

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