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

    The Snowflake Session API is a REST API that you can use to manage Snowflake sessions and session tokens.  # noqa: E501

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

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

from typing import Optional
from typing import Union
from snowflake.core.session._generated.pydantic_compatibility import BaseModel, Field, StrictInt, StrictStr


class CreateSessionResponse(BaseModel):
    token: Optional[StrictStr] = None
    validity_in_seconds: Optional[StrictInt] = Field(None,
                                                     alias="validityInSeconds")
    master_token: Optional[StrictStr] = Field(None, alias="masterToken")
    master_validity_in_seconds: Optional[StrictInt] = Field(
        None, alias="masterValidityInSeconds")
    session_id: Optional[StrictInt] = Field(None, alias="sessionId")
    __properties = [
        "token", "validityInSeconds", "masterToken", "masterValidityInSeconds",
        "sessionId"
    ]

    class Config:
        allow_population_by_field_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) -> CreateSessionResponse:
        """Create an instance of CreateSessionResponse 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 = self.dict(by_alias=True,
                          exclude={
                              "token",
                              "validity_in_seconds",
                              "master_token",
                              "master_validity_in_seconds",
                              "session_id",
                          },
                          exclude_none=True)
        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> CreateSessionResponse:
        """Create an instance of CreateSessionResponse from a dict"""
        if obj is None:
            return None

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

        _obj = CreateSessionResponse.parse_obj({
            "token":
            obj.get("token"),
            "validity_in_seconds":
            obj.get("validityInSeconds"),
            "master_token":
            obj.get("masterToken"),
            "master_validity_in_seconds":
            obj.get("masterValidityInSeconds"),
            "session_id":
            obj.get("sessionId"),
        })
        return _obj


from typing import Optional, List, Dict


class CreateSessionResponseModel():

    def __init__(
        self,
        # optional properties
        token: Optional[str] = None,
        validity_in_seconds: Optional[int] = None,
        master_token: Optional[str] = None,
        master_validity_in_seconds: Optional[int] = None,
        session_id: Optional[int] = None,
    ):
        self.token = token
        self.validity_in_seconds = validity_in_seconds
        self.master_token = master_token
        self.master_validity_in_seconds = master_validity_in_seconds
        self.session_id = session_id

    __properties = [
        "token", "validityInSeconds", "masterToken", "masterValidityInSeconds",
        "sessionId"
    ]

    def _to_model(self):
        return CreateSessionResponse(
            token=self.token,
            validity_in_seconds=self.validity_in_seconds,
            master_token=self.master_token,
            master_validity_in_seconds=self.master_validity_in_seconds,
            session_id=self.session_id,
        )

    @classmethod
    def _from_model(cls, model) -> CreateSessionResponseModel:
        return CreateSessionResponseModel(
            token=model.token,
            validity_in_seconds=model.validity_in_seconds,
            master_token=model.master_token,
            master_validity_in_seconds=model.master_validity_in_seconds,
            session_id=model.session_id,
        )

    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) -> CreateSessionResponseModel:
        """Create an instance of CreateSessionResponse from a dict"""
        return cls._from_model(CreateSessionResponse.from_dict(obj))


CreateSessionResponse._model_class = CreateSessionResponseModel
