# coding: utf-8

"""
    Moodle Webservice API

    Auto-generated OpenAPI spec for Moodle's Webservice API.

    The version of the OpenAPI document: 5.0.2 (Build: 20250811)
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


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

from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from poodle_async_mini.models.gradereport_user_get_grade_items_response_warnings_inner import GradereportUserGetGradeItemsResponseWarningsInner
from poodle_async_mini.models.tool_mobile_get_public_config_response_identityproviders_inner import ToolMobileGetPublicConfigResponseIdentityprovidersInner
from typing import Optional, Set
from typing_extensions import Self

from poodle_async_mini.configuration import settings

class ToolMobileGetPublicConfigResponse(BaseModel):
    """
    ToolMobileGetPublicConfigResponse
    """ # noqa: E501
    agedigitalconsentverification: Optional[StrictBool] = Field(default=None, description="Whether age digital consent verification                     is enabled.")
    authinstructions: Optional[StrictStr] = Field(description="Authentication instructions.")
    authloginviaemail: Optional[StrictInt] = Field(description="Whether log in via email is enabled.")
    authnoneenabled: Optional[StrictInt] = Field(description="Whether auth none is enabled.")
    autolang: Optional[StrictInt] = Field(default=None, description="Whether to detect default language                     from browser setting.")
    compactlogourl: Optional[StrictStr] = Field(default=None, description="The site compact logo URL")
    country: Optional[StrictStr] = Field(default=None, description="Default site country")
    enablemobilewebservice: Optional[StrictInt] = Field(description="Whether the Mobile service is enabled.")
    enablewebservices: Optional[StrictInt] = Field(description="Whether Web Services are enabled.")
    forgottenpasswordurl: Optional[StrictStr] = Field(description="Forgotten password URL.")
    guestlogin: Optional[StrictInt] = Field(description="Whether guest login is enabled.")
    httpswwwroot: Optional[StrictStr] = Field(description="Site https URL (if httpslogin is enabled).")
    identityproviders: Optional[List[ToolMobileGetPublicConfigResponseIdentityprovidersInner]] = Field(default=None, description="Identity providers")
    lang: Optional[StrictStr] = Field(default=None, description="Default language for the site.")
    langlist: Optional[StrictStr] = Field(default=None, description="Languages on language menu.")
    langmenu: Optional[StrictInt] = Field(default=None, description="Whether the language menu should be displayed.")
    launchurl: Optional[StrictStr] = Field(default=None, description="SSO login launch URL.")
    locale: Optional[StrictStr] = Field(default=None, description="Sitewide locale.")
    logourl: Optional[StrictStr] = Field(default=None, description="The site logo URL")
    maintenanceenabled: Optional[StrictInt] = Field(description="Whether site maintenance is enabled.")
    maintenancemessage: Optional[StrictStr] = Field(description="Maintenance message.")
    mobilecssurl: Optional[StrictStr] = Field(default=None, description="Mobile custom CSS theme")
    registerauth: Optional[StrictStr] = Field(description="Authentication method for user registration.")
    rememberusername: Optional[StrictInt] = Field(description="Values: 0 for No, 1 for Yes, 2 for optional.")
    showloginform: Optional[StrictInt] = Field(description="Display default login form.")
    sitename: Optional[StrictStr] = Field(description="Site name.")
    supportavailability: Optional[StrictInt] = Field(default=None, description="Determines who has access to contact site support.")
    supportemail: Optional[StrictStr] = Field(default=None, description="Site support contact email                     (only if age verification is enabled).")
    supportname: Optional[StrictStr] = Field(default=None, description="Site support contact name                     (only if age verification is enabled).")
    supportpage: Optional[StrictStr] = Field(default=None, description="Site support page link.")
    tool_mobile_androidappid: Optional[StrictStr] = Field(default=None, description="Android app's unique identifier.")
    tool_mobile_disabledfeatures: Optional[StrictStr] = Field(default=None, description="Disabled features in the app")
    tool_mobile_iosappid: Optional[StrictStr] = Field(default=None, description="iOS app's unique identifier.")
    tool_mobile_minimumversion: Optional[StrictStr] = Field(default=None, description="Minimum required version to access.")
    tool_mobile_qrcodetype: Optional[StrictInt] = Field(default=None, description="QR login configuration.")
    tool_mobile_setuplink: Optional[StrictStr] = Field(default=None, description="App download page.")
    typeoflogin: Optional[StrictInt] = Field(description="The type of login. 1 for app, 2 for browser, 3 for embedded.")
    warnings: Optional[List[GradereportUserGetGradeItemsResponseWarningsInner]] = Field(default=None, description="list of warnings")
    wwwroot: Optional[StrictStr] = Field(description="Site URL.")
    __properties: ClassVar[List[str]] = ["agedigitalconsentverification", "authinstructions", "authloginviaemail", "authnoneenabled", "autolang", "compactlogourl", "country", "enablemobilewebservice", "enablewebservices", "forgottenpasswordurl", "guestlogin", "httpswwwroot", "identityproviders", "lang", "langlist", "langmenu", "launchurl", "locale", "logourl", "maintenanceenabled", "maintenancemessage", "mobilecssurl", "registerauth", "rememberusername", "showloginform", "sitename", "supportavailability", "supportemail", "supportname", "supportpage", "tool_mobile_androidappid", "tool_mobile_disabledfeatures", "tool_mobile_iosappid", "tool_mobile_minimumversion", "tool_mobile_qrcodetype", "tool_mobile_setuplink", "typeoflogin", "warnings", "wwwroot"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )


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

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

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

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # override the default output from pydantic by calling `to_dict()` of each item in identityproviders (list)
        _items = []
        if self.identityproviders:
            for _item_identityproviders in self.identityproviders:
                if _item_identityproviders:
                    _items.append(_item_identityproviders.to_dict())
            _dict['identityproviders'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in warnings (list)
        _items = []
        if self.warnings:
            for _item_warnings in self.warnings:
                if _item_warnings:
                    _items.append(_item_warnings.to_dict())
            _dict['warnings'] = _items
        # set to None if agedigitalconsentverification (nullable) is None
        # and model_fields_set contains the field
        if self.agedigitalconsentverification is None and "agedigitalconsentverification" in self.model_fields_set:
            _dict['agedigitalconsentverification'] = None

        # set to None if authinstructions (nullable) is None
        # and model_fields_set contains the field
        if self.authinstructions is None and "authinstructions" in self.model_fields_set:
            _dict['authinstructions'] = None

        # set to None if authloginviaemail (nullable) is None
        # and model_fields_set contains the field
        if self.authloginviaemail is None and "authloginviaemail" in self.model_fields_set:
            _dict['authloginviaemail'] = None

        # set to None if authnoneenabled (nullable) is None
        # and model_fields_set contains the field
        if self.authnoneenabled is None and "authnoneenabled" in self.model_fields_set:
            _dict['authnoneenabled'] = None

        # set to None if autolang (nullable) is None
        # and model_fields_set contains the field
        if self.autolang is None and "autolang" in self.model_fields_set:
            _dict['autolang'] = None

        # set to None if compactlogourl (nullable) is None
        # and model_fields_set contains the field
        if self.compactlogourl is None and "compactlogourl" in self.model_fields_set:
            _dict['compactlogourl'] = None

        # set to None if country (nullable) is None
        # and model_fields_set contains the field
        if self.country is None and "country" in self.model_fields_set:
            _dict['country'] = None

        # set to None if enablemobilewebservice (nullable) is None
        # and model_fields_set contains the field
        if self.enablemobilewebservice is None and "enablemobilewebservice" in self.model_fields_set:
            _dict['enablemobilewebservice'] = None

        # set to None if enablewebservices (nullable) is None
        # and model_fields_set contains the field
        if self.enablewebservices is None and "enablewebservices" in self.model_fields_set:
            _dict['enablewebservices'] = None

        # set to None if forgottenpasswordurl (nullable) is None
        # and model_fields_set contains the field
        if self.forgottenpasswordurl is None and "forgottenpasswordurl" in self.model_fields_set:
            _dict['forgottenpasswordurl'] = None

        # set to None if guestlogin (nullable) is None
        # and model_fields_set contains the field
        if self.guestlogin is None and "guestlogin" in self.model_fields_set:
            _dict['guestlogin'] = None

        # set to None if httpswwwroot (nullable) is None
        # and model_fields_set contains the field
        if self.httpswwwroot is None and "httpswwwroot" in self.model_fields_set:
            _dict['httpswwwroot'] = None

        # set to None if lang (nullable) is None
        # and model_fields_set contains the field
        if self.lang is None and "lang" in self.model_fields_set:
            _dict['lang'] = None

        # set to None if langlist (nullable) is None
        # and model_fields_set contains the field
        if self.langlist is None and "langlist" in self.model_fields_set:
            _dict['langlist'] = None

        # set to None if langmenu (nullable) is None
        # and model_fields_set contains the field
        if self.langmenu is None and "langmenu" in self.model_fields_set:
            _dict['langmenu'] = None

        # set to None if launchurl (nullable) is None
        # and model_fields_set contains the field
        if self.launchurl is None and "launchurl" in self.model_fields_set:
            _dict['launchurl'] = None

        # set to None if locale (nullable) is None
        # and model_fields_set contains the field
        if self.locale is None and "locale" in self.model_fields_set:
            _dict['locale'] = None

        # set to None if logourl (nullable) is None
        # and model_fields_set contains the field
        if self.logourl is None and "logourl" in self.model_fields_set:
            _dict['logourl'] = None

        # set to None if maintenanceenabled (nullable) is None
        # and model_fields_set contains the field
        if self.maintenanceenabled is None and "maintenanceenabled" in self.model_fields_set:
            _dict['maintenanceenabled'] = None

        # set to None if maintenancemessage (nullable) is None
        # and model_fields_set contains the field
        if self.maintenancemessage is None and "maintenancemessage" in self.model_fields_set:
            _dict['maintenancemessage'] = None

        # set to None if mobilecssurl (nullable) is None
        # and model_fields_set contains the field
        if self.mobilecssurl is None and "mobilecssurl" in self.model_fields_set:
            _dict['mobilecssurl'] = None

        # set to None if registerauth (nullable) is None
        # and model_fields_set contains the field
        if self.registerauth is None and "registerauth" in self.model_fields_set:
            _dict['registerauth'] = None

        # set to None if rememberusername (nullable) is None
        # and model_fields_set contains the field
        if self.rememberusername is None and "rememberusername" in self.model_fields_set:
            _dict['rememberusername'] = None

        # set to None if showloginform (nullable) is None
        # and model_fields_set contains the field
        if self.showloginform is None and "showloginform" in self.model_fields_set:
            _dict['showloginform'] = None

        # set to None if sitename (nullable) is None
        # and model_fields_set contains the field
        if self.sitename is None and "sitename" in self.model_fields_set:
            _dict['sitename'] = None

        # set to None if supportavailability (nullable) is None
        # and model_fields_set contains the field
        if self.supportavailability is None and "supportavailability" in self.model_fields_set:
            _dict['supportavailability'] = None

        # set to None if supportemail (nullable) is None
        # and model_fields_set contains the field
        if self.supportemail is None and "supportemail" in self.model_fields_set:
            _dict['supportemail'] = None

        # set to None if supportname (nullable) is None
        # and model_fields_set contains the field
        if self.supportname is None and "supportname" in self.model_fields_set:
            _dict['supportname'] = None

        # set to None if supportpage (nullable) is None
        # and model_fields_set contains the field
        if self.supportpage is None and "supportpage" in self.model_fields_set:
            _dict['supportpage'] = None

        # set to None if tool_mobile_androidappid (nullable) is None
        # and model_fields_set contains the field
        if self.tool_mobile_androidappid is None and "tool_mobile_androidappid" in self.model_fields_set:
            _dict['tool_mobile_androidappid'] = None

        # set to None if tool_mobile_disabledfeatures (nullable) is None
        # and model_fields_set contains the field
        if self.tool_mobile_disabledfeatures is None and "tool_mobile_disabledfeatures" in self.model_fields_set:
            _dict['tool_mobile_disabledfeatures'] = None

        # set to None if tool_mobile_iosappid (nullable) is None
        # and model_fields_set contains the field
        if self.tool_mobile_iosappid is None and "tool_mobile_iosappid" in self.model_fields_set:
            _dict['tool_mobile_iosappid'] = None

        # set to None if tool_mobile_minimumversion (nullable) is None
        # and model_fields_set contains the field
        if self.tool_mobile_minimumversion is None and "tool_mobile_minimumversion" in self.model_fields_set:
            _dict['tool_mobile_minimumversion'] = None

        # set to None if tool_mobile_qrcodetype (nullable) is None
        # and model_fields_set contains the field
        if self.tool_mobile_qrcodetype is None and "tool_mobile_qrcodetype" in self.model_fields_set:
            _dict['tool_mobile_qrcodetype'] = None

        # set to None if tool_mobile_setuplink (nullable) is None
        # and model_fields_set contains the field
        if self.tool_mobile_setuplink is None and "tool_mobile_setuplink" in self.model_fields_set:
            _dict['tool_mobile_setuplink'] = None

        # set to None if typeoflogin (nullable) is None
        # and model_fields_set contains the field
        if self.typeoflogin is None and "typeoflogin" in self.model_fields_set:
            _dict['typeoflogin'] = None

        # set to None if wwwroot (nullable) is None
        # and model_fields_set contains the field
        if self.wwwroot is None and "wwwroot" in self.model_fields_set:
            _dict['wwwroot'] = None

        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of ToolMobileGetPublicConfigResponse from a dict"""
        if obj is None:
            return None

        relaxed = settings.relaxe_all_models or "ToolMobileGetPublicConfigResponse" in settings.relaxed_models

        if not isinstance(obj, dict):
            return cls.model_construct(**obj) if relaxed else cls.model_validate(obj)

        data = {
            "agedigitalconsentverification": obj.get("agedigitalconsentverification"),
            "authinstructions": obj.get("authinstructions"),
            "authloginviaemail": obj.get("authloginviaemail"),
            "authnoneenabled": obj.get("authnoneenabled"),
            "autolang": obj.get("autolang"),
            "compactlogourl": obj.get("compactlogourl"),
            "country": obj.get("country"),
            "enablemobilewebservice": obj.get("enablemobilewebservice"),
            "enablewebservices": obj.get("enablewebservices"),
            "forgottenpasswordurl": obj.get("forgottenpasswordurl"),
            "guestlogin": obj.get("guestlogin"),
            "httpswwwroot": obj.get("httpswwwroot"),
            "identityproviders": [ToolMobileGetPublicConfigResponseIdentityprovidersInner.from_dict(_item) for _item in obj["identityproviders"]] if obj.get("identityproviders") is not None else None,
            "lang": obj.get("lang"),
            "langlist": obj.get("langlist"),
            "langmenu": obj.get("langmenu"),
            "launchurl": obj.get("launchurl"),
            "locale": obj.get("locale"),
            "logourl": obj.get("logourl"),
            "maintenanceenabled": obj.get("maintenanceenabled"),
            "maintenancemessage": obj.get("maintenancemessage"),
            "mobilecssurl": obj.get("mobilecssurl"),
            "registerauth": obj.get("registerauth"),
            "rememberusername": obj.get("rememberusername"),
            "showloginform": obj.get("showloginform"),
            "sitename": obj.get("sitename"),
            "supportavailability": obj.get("supportavailability"),
            "supportemail": obj.get("supportemail"),
            "supportname": obj.get("supportname"),
            "supportpage": obj.get("supportpage"),
            "tool_mobile_androidappid": obj.get("tool_mobile_androidappid"),
            "tool_mobile_disabledfeatures": obj.get("tool_mobile_disabledfeatures"),
            "tool_mobile_iosappid": obj.get("tool_mobile_iosappid"),
            "tool_mobile_minimumversion": obj.get("tool_mobile_minimumversion"),
            "tool_mobile_qrcodetype": obj.get("tool_mobile_qrcodetype"),
            "tool_mobile_setuplink": obj.get("tool_mobile_setuplink"),
            "typeoflogin": obj.get("typeoflogin"),
            "warnings": [GradereportUserGetGradeItemsResponseWarningsInner.from_dict(_item) for _item in obj["warnings"]] if obj.get("warnings") is not None else None,
            "wwwroot": obj.get("wwwroot")
        }
        _obj = cls.model_construct(**data) if relaxed else cls.model_validate(data)
        return _obj


