# coding: utf-8

"""
    Financial Reports API

    API for accessing company filings, financial data, industry classifications, and related information.

    The version of the OpenAPI document: 1.0.0
    Contact: api@financialreports.eu
    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 date
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List
from financial_reports_generated_client.models.industry import Industry
from financial_reports_generated_client.models.industry_group import IndustryGroup
from financial_reports_generated_client.models.sector import Sector
from financial_reports_generated_client.models.sub_industry import SubIndustry
from typing import Optional, Set
from typing_extensions import Self

class Company(BaseModel):
    """
    Provides a detailed representation of a Company.
    """ # noqa: E501
    id: StrictInt = Field(description="Unique identifier for the company.")
    name: StrictStr = Field(description="Company name.")
    lei: StrictStr = Field(description="Legal Entity Identifier (ISO 17442).")
    country_code: StrictStr = Field(description="ISO 3166-1 alpha-2 country code of the company's primary registration or headquarters.")
    sector: Sector = Field(description="Company's GICS Sector classification.")
    industry_group: IndustryGroup = Field(description="Company's GICS Industry Group classification.")
    industry: Industry = Field(description="Company's GICS Industry classification.")
    sub_industry: SubIndustry = Field(description="Company's GICS Sub-Industry classification.")
    ir_link: StrictStr = Field(description="Link to the company's Investor Relations page.")
    homepage_link: StrictStr = Field(description="Link to the company's main homepage.")
    date_public: date = Field(description="Date the company first became public.")
    date_ipo: date = Field(description="Date of the company's Initial Public Offering.")
    main_stock_exchange: StrictStr = Field(description="Primary stock exchange where the company is listed.")
    social_facebook: StrictStr = Field(description="Facebook profile/page identifier.")
    social_instagram: StrictStr = Field(description="Instagram profile identifier.")
    social_twitter: StrictStr = Field(description="Twitter handle (without @).")
    social_linkedin: StrictStr = Field(description="LinkedIn company page identifier/URL path.")
    social_youtube: StrictStr = Field(description="YouTube channel identifier.")
    social_tiktok: StrictStr = Field(description="TikTok profile identifier.")
    social_pinterest: StrictStr = Field(description="Pinterest profile identifier.")
    social_xing: StrictStr = Field(description="Xing company profile identifier.")
    social_glassdoor: StrictStr = Field(description="Glassdoor company identifier.")
    year_founded: StrictInt = Field(description="Year the company was founded.")
    corporate_video_id: StrictStr = Field(description="Identifier for a corporate video (e.g., YouTube ID).")
    served_area: StrictStr = Field(description="Geographical area served by the company.")
    headcount: StrictInt = Field(description="Approximate number of employees.")
    contact_email: StrictStr = Field(description="General contact email address.")
    ticker: StrictStr = Field(description="Primary stock ticker symbol.")
    is_listed: StrictBool = Field(description="Indicates if the company is currently publicly listed.")
    __properties: ClassVar[List[str]] = ["id", "name", "lei", "country_code", "sector", "industry_group", "industry", "sub_industry", "ir_link", "homepage_link", "date_public", "date_ipo", "main_stock_exchange", "social_facebook", "social_instagram", "social_twitter", "social_linkedin", "social_youtube", "social_tiktok", "social_pinterest", "social_xing", "social_glassdoor", "year_founded", "corporate_video_id", "served_area", "headcount", "contact_email", "ticker", "is_listed"]

    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 Company 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.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        """
        excluded_fields: Set[str] = set([
            "id",
            "name",
            "lei",
            "country_code",
            "sector",
            "industry_group",
            "industry",
            "sub_industry",
            "ir_link",
            "homepage_link",
            "date_public",
            "date_ipo",
            "main_stock_exchange",
            "social_facebook",
            "social_instagram",
            "social_twitter",
            "social_linkedin",
            "social_youtube",
            "social_tiktok",
            "social_pinterest",
            "social_xing",
            "social_glassdoor",
            "year_founded",
            "corporate_video_id",
            "served_area",
            "headcount",
            "contact_email",
            "ticker",
            "is_listed",
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # override the default output from pydantic by calling `to_dict()` of sector
        if self.sector:
            _dict['sector'] = self.sector.to_dict()
        # override the default output from pydantic by calling `to_dict()` of industry_group
        if self.industry_group:
            _dict['industry_group'] = self.industry_group.to_dict()
        # override the default output from pydantic by calling `to_dict()` of industry
        if self.industry:
            _dict['industry'] = self.industry.to_dict()
        # override the default output from pydantic by calling `to_dict()` of sub_industry
        if self.sub_industry:
            _dict['sub_industry'] = self.sub_industry.to_dict()
        return _dict

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

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "id": obj.get("id"),
            "name": obj.get("name"),
            "lei": obj.get("lei"),
            "country_code": obj.get("country_code"),
            "sector": Sector.from_dict(obj["sector"]) if obj.get("sector") is not None else None,
            "industry_group": IndustryGroup.from_dict(obj["industry_group"]) if obj.get("industry_group") is not None else None,
            "industry": Industry.from_dict(obj["industry"]) if obj.get("industry") is not None else None,
            "sub_industry": SubIndustry.from_dict(obj["sub_industry"]) if obj.get("sub_industry") is not None else None,
            "ir_link": obj.get("ir_link"),
            "homepage_link": obj.get("homepage_link"),
            "date_public": obj.get("date_public"),
            "date_ipo": obj.get("date_ipo"),
            "main_stock_exchange": obj.get("main_stock_exchange"),
            "social_facebook": obj.get("social_facebook"),
            "social_instagram": obj.get("social_instagram"),
            "social_twitter": obj.get("social_twitter"),
            "social_linkedin": obj.get("social_linkedin"),
            "social_youtube": obj.get("social_youtube"),
            "social_tiktok": obj.get("social_tiktok"),
            "social_pinterest": obj.get("social_pinterest"),
            "social_xing": obj.get("social_xing"),
            "social_glassdoor": obj.get("social_glassdoor"),
            "year_founded": obj.get("year_founded"),
            "corporate_video_id": obj.get("corporate_video_id"),
            "served_area": obj.get("served_area"),
            "headcount": obj.get("headcount"),
            "contact_email": obj.get("contact_email"),
            "ticker": obj.get("ticker"),
            "is_listed": obj.get("is_listed")
        })
        return _obj


