/*
 * Orvanta API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.2.0
 * Contact: contact@orvanta.cloud
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct User {
    #[serde(rename = "email")]
    pub email: String,
    #[serde(rename = "username")]
    pub username: String,
    #[serde(rename = "is_admin")]
    pub is_admin: bool,
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(rename = "is_super_admin")]
    pub is_super_admin: bool,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "operator")]
    pub operator: bool,
    #[serde(rename = "disabled")]
    pub disabled: bool,
    #[serde(rename = "groups", skip_serializing_if = "Option::is_none")]
    pub groups: Option<Vec<String>>,
    #[serde(rename = "folders")]
    pub folders: Vec<String>,
    #[serde(rename = "folders_owners")]
    pub folders_owners: Vec<String>,
    #[serde(rename = "added_via", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub added_via: Option<Option<Box<models::UserSource>>>,
    #[serde(rename = "is_service_account", skip_serializing_if = "Option::is_none")]
    pub is_service_account: Option<bool>,
}

impl User {
    pub fn new(email: String, username: String, is_admin: bool, is_super_admin: bool, created_at: String, operator: bool, disabled: bool, folders: Vec<String>, folders_owners: Vec<String>) -> User {
        User {
            email,
            username,
            is_admin,
            name: None,
            is_super_admin,
            created_at,
            operator,
            disabled,
            groups: None,
            folders,
            folders_owners,
            added_via: None,
            is_service_account: None,
        }
    }
}

