# coding: utf-8

"""
    OneLogin API

    OpenAPI Specification for OneLogin  # noqa: E501

    The version of the OpenAPI document: 3.1.1
    Generated by: https://openapi-generator.tech
"""


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


from typing import List, Optional
from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, validator
from onelogin.models.list_apps200_response_provisioning import ListApps200ResponseProvisioning

class ListApps200Response(BaseModel):
    """NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """
    id: Optional[StrictInt] = Field(None, description="Apps unique ID in OneLogin.")
    connector_id: Optional[StrictInt] = Field(None, description="ID of the apps underlying connector.")
    name: Optional[StrictStr] = Field(None, description="App name.")
    description: Optional[StrictStr] = Field(None, description="Freeform description of the app.")
    notes: Optional[StrictStr] = Field(None, description="Freeform notes about the app.")
    policy_id: Optional[StrictInt] = Field(None, description="The security policy assigned to the app.")
    brand_id: Optional[StrictInt] = Field(None, description="The custom login page branding to use for this app. Applies to app initiated logins via OIDC or SAML.")
    icon_url: Optional[StrictStr] = Field(None, description="A link to the apps icon url.")
    visible: Optional[StrictBool] = Field(None, description="Indicates if the app is visible in the OneLogin portal.")
    auth_method: Optional[StrictInt] = Field(None, description="An ID indicating the type of app.")
    tab_id: Optional[StrictInt] = Field(None, description="ID of the OneLogin portal tab that the app is assigned to.")
    created_at: Optional[StrictStr] = Field(None, description="The date the app was created.")
    updated_at: Optional[StrictStr] = Field(None, description="The date the app was last updated.")
    role_ids: Optional[List[StrictInt]] = Field(None, description="A list of OneLogin Role IDs of the user")
    allow_assumed_signin: Optional[StrictBool] = Field(None, description="Indicates whether or not administrators can access the app as a user that they have assumed control over.")
    provisioning: Optional[ListApps200ResponseProvisioning] = None
    __properties = ["id", "connector_id", "name", "description", "notes", "policy_id", "brand_id", "icon_url", "visible", "auth_method", "tab_id", "created_at", "updated_at", "role_ids", "allow_assumed_signin", "provisioning"]

    @validator('auth_method')
    def auth_method_validate_enum(cls, v):
        if v is None:
            return v

        if v not in (0, 1, 2, 3, 4, 6, 7, 8):
            raise ValueError("must validate the enum values (0, 1, 2, 3, 4, 6, 7, 8)")
        return v

    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) -> ListApps200Response:
        """Create an instance of ListApps200Response 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={
                          },
                          exclude_none=True)
        # override the default output from pydantic by calling `to_dict()` of provisioning
        if self.provisioning:
            _dict['provisioning'] = self.provisioning.to_dict()
        return _dict

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

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

        _obj = ListApps200Response.parse_obj({
            "id": obj.get("id"),
            "connector_id": obj.get("connector_id"),
            "name": obj.get("name"),
            "description": obj.get("description"),
            "notes": obj.get("notes"),
            "policy_id": obj.get("policy_id"),
            "brand_id": obj.get("brand_id"),
            "icon_url": obj.get("icon_url"),
            "visible": obj.get("visible"),
            "auth_method": obj.get("auth_method"),
            "tab_id": obj.get("tab_id"),
            "created_at": obj.get("created_at"),
            "updated_at": obj.get("updated_at"),
            "role_ids": obj.get("role_ids"),
            "allow_assumed_signin": obj.get("allow_assumed_signin"),
            "provisioning": ListApps200ResponseProvisioning.from_dict(obj.get("provisioning")) if obj.get("provisioning") is not None else None
        })
        return _obj

