# coding: utf-8

"""
    Lookup/Ibis web service API

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 1.2
    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 datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field, StrictInt, StrictStr

class Attribute(BaseModel):
    """
    Class representing an attribute of a person or institution returned by the web service API. Note that for institution attributes, the instid, visibility and owningGroupid fields will be `null`.
    """
    attrid: Optional[StrictInt] = Field(None, description="The unique internal identifier of the attribute.")
    scheme: Optional[StrictStr] = Field(None, description="The attribute's scheme.")
    value: Optional[StrictStr] = Field(None, description="The attribute's value (except for binary attributes).")
    comment: Optional[StrictStr] = Field(None, description="Any comment associated with the attribute.")
    instid: Optional[StrictStr] = Field(None, description="For a person attribute, the optional institution that the attribute is associated with. This will not be set for institution attributes.")
    visibility: Optional[StrictStr] = Field(None, description="For a person attribute, it's visibility (`\"private\"`, `\"institution\"`, `\"university\"` or `\"world\"`). This will not be set for institution attributes.")
    effective_from: Optional[datetime] = Field(None, alias="effectiveFrom", description="For time-limited attributes, the date from which it takes effect.")
    effective_to: Optional[datetime] = Field(None, alias="effectiveTo", description="For time-limited attributes, the date after which it is no longer effective.")
    owning_groupid: Optional[StrictStr] = Field(None, alias="owningGroupid", description="For a person attribute, the ID of the group that owns it (typically the user agent group that created it).")
    __properties = ["attrid", "scheme", "value", "comment", "instid", "visibility", "effectiveFrom", "effectiveTo", "owningGroupid"]

    class Config:
        """Pydantic configuration"""
        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) -> Attribute:
        """Create an instance of Attribute 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)
        return _dict

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

        if not isinstance(obj, dict):
            return Attribute.parse_obj(obj)

        _obj = Attribute.parse_obj({
            "attrid": obj.get("attrid"),
            "scheme": obj.get("scheme"),
            "value": obj.get("value"),
            "comment": obj.get("comment"),
            "instid": obj.get("instid"),
            "visibility": obj.get("visibility"),
            "effective_from": obj.get("effectiveFrom"),
            "effective_to": obj.get("effectiveTo"),
            "owning_groupid": obj.get("owningGroupid")
        })
        return _obj


