/*
 * Tribufu API
 *
 * API to access Tribufu services.
 *
 * The version of the OpenAPI document: 1.3.0
 * Contact: contact@tribufu.com
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Client {
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    #[serde(rename = "name", deserialize_with = "Option::deserialize")]
    pub name: Option<String>,
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<models::ClientType>,
    #[serde(rename = "organization_id", skip_serializing_if = "Option::is_none")]
    pub organization_id: Option<String>,
    #[serde(rename = "trusted", skip_serializing_if = "Option::is_none")]
    pub trusted: Option<bool>,
    #[serde(rename = "website_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub website_url: Option<Option<String>>,
    #[serde(rename = "photo_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub photo_url: Option<Option<String>>,
    #[serde(rename = "background_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub background_url: Option<Option<String>>,
    #[serde(rename = "redirects", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub redirects: Option<Option<String>>,
    #[serde(rename = "scopes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub scopes: Option<Option<String>>,
    #[serde(rename = "permissions", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub permissions: Option<Option<Vec<String>>>,
    #[serde(rename = "created", skip_serializing_if = "Option::is_none")]
    pub created: Option<String>,
    #[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub updated: Option<Option<String>>,
}

impl Client {
    pub fn new(name: Option<String>) -> Client {
        Client {
            id: None,
            name,
            r#type: None,
            organization_id: None,
            trusted: None,
            website_url: None,
            photo_url: None,
            background_url: None,
            redirects: None,
            scopes: None,
            permissions: None,
            created: None,
            updated: None,
        }
    }
}

