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