// authentik
//
// Making authentication simple.
//
// The version of the OpenAPI document: 2026.5.0-rc1
// Contact: hello@goauthentik.io
// Generated by: https://openapi-generator.tech

use serde::{Deserialize, Serialize};

use crate::models;

/// PartialUser : Partial User Serializer, does not include child relations.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PartialUser {
    #[serde(rename = "pk")]
    pub pk: i32,
    /// Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
    #[serde(rename = "username")]
    pub username: String,
    /// User's display name.
    #[serde(rename = "name")]
    pub name: String,
    /// Designates whether this user should be treated as active. Unselect this instead of deleting
    /// accounts.
    #[serde(rename = "is_active", skip_serializing_if = "Option::is_none")]
    pub is_active: Option<bool>,
    #[serde(
        rename = "last_login",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub last_login: Option<Option<String>>,
    #[serde(rename = "email", skip_serializing_if = "Option::is_none")]
    pub email: Option<String>,
    #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")]
    pub attributes: Option<std::collections::HashMap<String, serde_json::Value>>,
    #[serde(rename = "uid")]
    pub uid: String,
}

impl PartialUser {
    /// Partial User Serializer, does not include child relations.
    pub fn new(pk: i32, username: String, name: String, uid: String) -> PartialUser {
        PartialUser {
            pk,
            username,
            name,
            is_active: None,
            last_login: None,
            email: None,
            attributes: None,
            uid,
        }
    }
}
