/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.
 *
 * The version of the OpenAPI document: 1.2.1
 * 
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct LoginResponse {
    #[serde(rename = "access_token")]
    pub access_token: String,
    #[serde(rename = "expires_in")]
    pub expires_in: i64,
    #[serde(rename = "must_change_password")]
    pub must_change_password: bool,
    #[serde(rename = "refresh_token")]
    pub refresh_token: String,
    #[serde(rename = "token_type")]
    pub token_type: String,
    #[serde(rename = "totp_required", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub totp_required: Option<Option<bool>>,
    #[serde(rename = "totp_token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub totp_token: Option<Option<String>>,
}

impl LoginResponse {
    pub fn new(access_token: String, expires_in: i64, must_change_password: bool, refresh_token: String, token_type: String) -> LoginResponse {
        LoginResponse {
            access_token,
            expires_in,
            must_change_password,
            refresh_token,
            token_type,
            totp_required: None,
            totp_token: None,
        }
    }
}

