# coding: utf-8
"""
    Snowflake User API

    The Snowflake User API is a REST API that you can use to access, update, and perform certain action on Users in a Snowflake database.  # noqa: E501

    The version of the OpenAPI document: 0.0.1
    Contact: support@snowflake.com
    Generated by: https://openapi-generator.tech

    Do not edit this file manually.
"""

from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from typing import Union

from datetime import datetime

from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr

from typing import Any, ClassVar, Dict, List, Optional


class User(BaseModel):

    name: StrictStr

    password: Optional[StrictStr] = None

    login_name: Optional[StrictStr] = None

    display_name: Optional[StrictStr] = None

    first_name: Optional[StrictStr] = None

    middle_name: Optional[StrictStr] = None

    last_name: Optional[StrictStr] = None

    email: Optional[StrictStr] = None

    must_change_password: Optional[StrictBool] = None

    disabled: Optional[StrictBool] = None

    days_to_expiry: Optional[StrictInt] = None

    mins_to_unlock: Optional[StrictInt] = None

    default_warehouse: Optional[StrictStr] = None

    default_namespace: Optional[StrictStr] = None

    default_role: Optional[StrictStr] = None

    default_secondary_roles: Optional[StrictStr] = None

    mins_to_bypass_mfa: Optional[StrictInt] = None

    rsa_public_key: Optional[StrictStr] = None

    rsa_public_key_fp: Optional[StrictStr] = None

    rsa_public_key_2: Optional[StrictStr] = None

    rsa_public_key_2_fp: Optional[StrictStr] = None

    comment: Optional[StrictStr] = None

    type: Optional[StrictStr] = None

    created_on: Optional[datetime] = None

    last_successful_login: Optional[datetime] = None

    expires_at: Optional[datetime] = None

    locked_until: Optional[datetime] = None

    has_password: Optional[StrictBool] = None

    has_rsa_public_key: Optional[StrictBool] = None

    ext_authn_duo: Optional[StrictBool] = None

    ext_authn_uid: Optional[StrictStr] = None

    owner: Optional[StrictStr] = None

    snowflake_lock: Optional[StrictBool] = False

    snowflake_support: Optional[StrictBool] = False

    mins_to_bypass_network_policy: Optional[StrictInt] = None

    password_last_set: Optional[datetime] = None

    custom_landing_page_url: Optional[StrictStr] = None

    custom_landing_page_url_flush_next_ui_load: Optional[StrictBool] = False

    __properties = [
        "name", "password", "login_name", "display_name", "first_name",
        "middle_name", "last_name", "email", "must_change_password",
        "disabled", "days_to_expiry", "mins_to_unlock", "default_warehouse",
        "default_namespace", "default_role", "default_secondary_roles",
        "mins_to_bypass_mfa", "rsa_public_key", "rsa_public_key_fp",
        "rsa_public_key_2", "rsa_public_key_2_fp", "comment", "type",
        "created_on", "last_successful_login", "expires_at", "locked_until",
        "has_password", "has_rsa_public_key", "ext_authn_duo", "ext_authn_uid",
        "owner", "snowflake_lock", "snowflake_support",
        "mins_to_bypass_network_policy", "password_last_set",
        "custom_landing_page_url", "custom_landing_page_url_flush_next_ui_load"
    ]

    class Config:
        populate_by_name = True
        validate_assignment = True

    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.dict(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> User:
        """Create an instance of User from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = dict(
            self._iter(to_dict=True,
                       by_alias=True,
                       exclude={
                           "created_on",
                           "last_successful_login",
                           "expires_at",
                           "locked_until",
                           "has_password",
                           "has_rsa_public_key",
                           "ext_authn_duo",
                           "ext_authn_uid",
                           "owner",
                           "snowflake_lock",
                           "snowflake_support",
                           "mins_to_bypass_network_policy",
                           "password_last_set",
                           "custom_landing_page_url",
                           "custom_landing_page_url_flush_next_ui_load",
                       },
                       exclude_none=True))

        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> User:
        """Create an instance of User from a dict"""

        if obj is None:
            return None

        if type(obj) is not dict:
            return User.parse_obj(obj)

        _obj = User.parse_obj({
            "name":
            obj.get("name"),
            "password":
            obj.get("password"),
            "login_name":
            obj.get("login_name"),
            "display_name":
            obj.get("display_name"),
            "first_name":
            obj.get("first_name"),
            "middle_name":
            obj.get("middle_name"),
            "last_name":
            obj.get("last_name"),
            "email":
            obj.get("email"),
            "must_change_password":
            obj.get("must_change_password"),
            "disabled":
            obj.get("disabled"),
            "days_to_expiry":
            obj.get("days_to_expiry"),
            "mins_to_unlock":
            obj.get("mins_to_unlock"),
            "default_warehouse":
            obj.get("default_warehouse"),
            "default_namespace":
            obj.get("default_namespace"),
            "default_role":
            obj.get("default_role"),
            "default_secondary_roles":
            obj.get("default_secondary_roles"),
            "mins_to_bypass_mfa":
            obj.get("mins_to_bypass_mfa"),
            "rsa_public_key":
            obj.get("rsa_public_key"),
            "rsa_public_key_fp":
            obj.get("rsa_public_key_fp"),
            "rsa_public_key_2":
            obj.get("rsa_public_key_2"),
            "rsa_public_key_2_fp":
            obj.get("rsa_public_key_2_fp"),
            "comment":
            obj.get("comment"),
            "type":
            obj.get("type"),
            "created_on":
            obj.get("created_on"),
            "last_successful_login":
            obj.get("last_successful_login"),
            "expires_at":
            obj.get("expires_at"),
            "locked_until":
            obj.get("locked_until"),
            "has_password":
            obj.get("has_password"),
            "has_rsa_public_key":
            obj.get("has_rsa_public_key"),
            "ext_authn_duo":
            obj.get("ext_authn_duo"),
            "ext_authn_uid":
            obj.get("ext_authn_uid"),
            "owner":
            obj.get("owner"),
            "snowflake_lock":
            obj.get("snowflake_lock")
            if obj.get("snowflake_lock") is not None else False,
            "snowflake_support":
            obj.get("snowflake_support")
            if obj.get("snowflake_support") is not None else False,
            "mins_to_bypass_network_policy":
            obj.get("mins_to_bypass_network_policy"),
            "password_last_set":
            obj.get("password_last_set"),
            "custom_landing_page_url":
            obj.get("custom_landing_page_url"),
            "custom_landing_page_url_flush_next_ui_load":
            obj.get("custom_landing_page_url_flush_next_ui_load")
            if obj.get("custom_landing_page_url_flush_next_ui_load")
            is not None else False,
        })

        return _obj


from typing import Optional, List, Dict


class UserModel():

    def __init__(
        self,
        name: str,
        # optional properties
        password: Optional[str] = None,
        login_name: Optional[str] = None,
        display_name: Optional[str] = None,
        first_name: Optional[str] = None,
        middle_name: Optional[str] = None,
        last_name: Optional[str] = None,
        email: Optional[str] = None,
        must_change_password: Optional[bool] = None,
        disabled: Optional[bool] = None,
        days_to_expiry: Optional[int] = None,
        mins_to_unlock: Optional[int] = None,
        default_warehouse: Optional[str] = None,
        default_namespace: Optional[str] = None,
        default_role: Optional[str] = None,
        default_secondary_roles: Optional[str] = None,
        mins_to_bypass_mfa: Optional[int] = None,
        rsa_public_key: Optional[str] = None,
        rsa_public_key_fp: Optional[str] = None,
        rsa_public_key_2: Optional[str] = None,
        rsa_public_key_2_fp: Optional[str] = None,
        comment: Optional[str] = None,
        type: Optional[str] = None,
        created_on: Optional[datetime] = None,
        last_successful_login: Optional[datetime] = None,
        expires_at: Optional[datetime] = None,
        locked_until: Optional[datetime] = None,
        has_password: Optional[bool] = None,
        has_rsa_public_key: Optional[bool] = None,
        ext_authn_duo: Optional[bool] = None,
        ext_authn_uid: Optional[str] = None,
        owner: Optional[str] = None,
        snowflake_lock: Optional[bool] = False,
        snowflake_support: Optional[bool] = False,
        mins_to_bypass_network_policy: Optional[int] = None,
        password_last_set: Optional[datetime] = None,
        custom_landing_page_url: Optional[str] = None,
        custom_landing_page_url_flush_next_ui_load: Optional[bool] = False,
    ):

        self.name = name
        self.password = password
        self.login_name = login_name
        self.display_name = display_name
        self.first_name = first_name
        self.middle_name = middle_name
        self.last_name = last_name
        self.email = email
        self.must_change_password = must_change_password
        self.disabled = disabled
        self.days_to_expiry = days_to_expiry
        self.mins_to_unlock = mins_to_unlock
        self.default_warehouse = default_warehouse
        self.default_namespace = default_namespace
        self.default_role = default_role
        self.default_secondary_roles = default_secondary_roles
        self.mins_to_bypass_mfa = mins_to_bypass_mfa
        self.rsa_public_key = rsa_public_key
        self.rsa_public_key_fp = rsa_public_key_fp
        self.rsa_public_key_2 = rsa_public_key_2
        self.rsa_public_key_2_fp = rsa_public_key_2_fp
        self.comment = comment
        self.type = type
        self.created_on = created_on
        self.last_successful_login = last_successful_login
        self.expires_at = expires_at
        self.locked_until = locked_until
        self.has_password = has_password
        self.has_rsa_public_key = has_rsa_public_key
        self.ext_authn_duo = ext_authn_duo
        self.ext_authn_uid = ext_authn_uid
        self.owner = owner
        self.snowflake_lock = snowflake_lock
        self.snowflake_support = snowflake_support
        self.mins_to_bypass_network_policy = mins_to_bypass_network_policy
        self.password_last_set = password_last_set
        self.custom_landing_page_url = custom_landing_page_url
        self.custom_landing_page_url_flush_next_ui_load = custom_landing_page_url_flush_next_ui_load

    __properties = [
        "name", "password", "login_name", "display_name", "first_name",
        "middle_name", "last_name", "email", "must_change_password",
        "disabled", "days_to_expiry", "mins_to_unlock", "default_warehouse",
        "default_namespace", "default_role", "default_secondary_roles",
        "mins_to_bypass_mfa", "rsa_public_key", "rsa_public_key_fp",
        "rsa_public_key_2", "rsa_public_key_2_fp", "comment", "type",
        "created_on", "last_successful_login", "expires_at", "locked_until",
        "has_password", "has_rsa_public_key", "ext_authn_duo", "ext_authn_uid",
        "owner", "snowflake_lock", "snowflake_support",
        "mins_to_bypass_network_policy", "password_last_set",
        "custom_landing_page_url", "custom_landing_page_url_flush_next_ui_load"
    ]

    def _to_model(self):
        return User(
            name=self.name,
            password=self.password,
            login_name=self.login_name,
            display_name=self.display_name,
            first_name=self.first_name,
            middle_name=self.middle_name,
            last_name=self.last_name,
            email=self.email,
            must_change_password=self.must_change_password,
            disabled=self.disabled,
            days_to_expiry=self.days_to_expiry,
            mins_to_unlock=self.mins_to_unlock,
            default_warehouse=self.default_warehouse,
            default_namespace=self.default_namespace,
            default_role=self.default_role,
            default_secondary_roles=self.default_secondary_roles,
            mins_to_bypass_mfa=self.mins_to_bypass_mfa,
            rsa_public_key=self.rsa_public_key,
            rsa_public_key_fp=self.rsa_public_key_fp,
            rsa_public_key_2=self.rsa_public_key_2,
            rsa_public_key_2_fp=self.rsa_public_key_2_fp,
            comment=self.comment,
            type=self.type,
            created_on=self.created_on,
            last_successful_login=self.last_successful_login,
            expires_at=self.expires_at,
            locked_until=self.locked_until,
            has_password=self.has_password,
            has_rsa_public_key=self.has_rsa_public_key,
            ext_authn_duo=self.ext_authn_duo,
            ext_authn_uid=self.ext_authn_uid,
            owner=self.owner,
            snowflake_lock=self.snowflake_lock,
            snowflake_support=self.snowflake_support,
            mins_to_bypass_network_policy=self.mins_to_bypass_network_policy,
            password_last_set=self.password_last_set,
            custom_landing_page_url=self.custom_landing_page_url,
            custom_landing_page_url_flush_next_ui_load=self.
            custom_landing_page_url_flush_next_ui_load,
        )

    @classmethod
    def _from_model(cls, model) -> UserModel:
        return UserModel(
            name=model.name,
            password=model.password,
            login_name=model.login_name,
            display_name=model.display_name,
            first_name=model.first_name,
            middle_name=model.middle_name,
            last_name=model.last_name,
            email=model.email,
            must_change_password=model.must_change_password,
            disabled=model.disabled,
            days_to_expiry=model.days_to_expiry,
            mins_to_unlock=model.mins_to_unlock,
            default_warehouse=model.default_warehouse,
            default_namespace=model.default_namespace,
            default_role=model.default_role,
            default_secondary_roles=model.default_secondary_roles,
            mins_to_bypass_mfa=model.mins_to_bypass_mfa,
            rsa_public_key=model.rsa_public_key,
            rsa_public_key_fp=model.rsa_public_key_fp,
            rsa_public_key_2=model.rsa_public_key_2,
            rsa_public_key_2_fp=model.rsa_public_key_2_fp,
            comment=model.comment,
            type=model.type,
            created_on=model.created_on,
            last_successful_login=model.last_successful_login,
            expires_at=model.expires_at,
            locked_until=model.locked_until,
            has_password=model.has_password,
            has_rsa_public_key=model.has_rsa_public_key,
            ext_authn_duo=model.ext_authn_duo,
            ext_authn_uid=model.ext_authn_uid,
            owner=model.owner,
            snowflake_lock=model.snowflake_lock,
            snowflake_support=model.snowflake_support,
            mins_to_bypass_network_policy=model.mins_to_bypass_network_policy,
            password_last_set=model.password_last_set,
            custom_landing_page_url=model.custom_landing_page_url,
            custom_landing_page_url_flush_next_ui_load=model.
            custom_landing_page_url_flush_next_ui_load,
        )

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        return self._to_model().to_dict()

    @classmethod
    def from_dict(cls, obj: dict) -> UserModel:
        """Create an instance of User from a dict"""
        return cls._from_model(User.from_dict(obj))


User._model_class = UserModel
