# coding: utf-8

"""
    Nuon

    API for managing nuon apps, components, and installs.

    The version of the OpenAPI document: 0.19.216
    Contact: support@nuon.co
    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, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
try:
    from typing import Self
except ImportError:
    from typing_extensions import Self

class AppOtelLogRecord(BaseModel):
    """
    AppOtelLogRecord
    """ # noqa: E501
    body: Optional[StrictStr] = None
    created_at: Optional[StrictStr] = None
    created_by_id: Optional[StrictStr] = None
    id: Optional[StrictStr] = None
    log_attributes: Optional[Dict[str, StrictStr]] = None
    resource_attributes: Optional[Dict[str, StrictStr]] = None
    resource_schema_url: Optional[StrictStr] = None
    runner_group_id: Optional[StrictStr] = None
    runner_id: Optional[StrictStr] = Field(default=None, description="internal attributes")
    runner_job_execution_id: Optional[StrictStr] = None
    runner_job_id: Optional[StrictStr] = None
    scope_attributes: Optional[Dict[str, StrictStr]] = None
    scope_name: Optional[StrictStr] = None
    scope_schema_url: Optional[StrictStr] = None
    scope_version: Optional[StrictStr] = None
    service_name: Optional[StrictStr] = None
    severity_number: Optional[StrictInt] = None
    severity_text: Optional[StrictStr] = None
    span_id: Optional[StrictStr] = None
    timestamp: Optional[StrictStr] = Field(default=None, description="OTEL log message attributes")
    timestamp_date: Optional[StrictStr] = None
    timestamp_time: Optional[StrictStr] = None
    trace_flags: Optional[StrictInt] = None
    trace_id: Optional[StrictStr] = None
    updated_at: Optional[StrictStr] = None
    __properties: ClassVar[List[str]] = ["body", "created_at", "created_by_id", "id", "log_attributes", "resource_attributes", "resource_schema_url", "runner_group_id", "runner_id", "runner_job_execution_id", "runner_job_id", "scope_attributes", "scope_name", "scope_schema_url", "scope_version", "service_name", "severity_number", "severity_text", "span_id", "timestamp", "timestamp_date", "timestamp_time", "trace_flags", "trace_id", "updated_at"]

    model_config = {
        "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) -> Self:
        """Create an instance of AppOtelLogRecord 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.
        """
        _dict = self.model_dump(
            by_alias=True,
            exclude={
            },
            exclude_none=True,
        )
        return _dict

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

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

        _obj = cls.model_validate({
            "body": obj.get("body"),
            "created_at": obj.get("created_at"),
            "created_by_id": obj.get("created_by_id"),
            "id": obj.get("id"),
            "log_attributes": obj.get("log_attributes"),
            "resource_attributes": obj.get("resource_attributes"),
            "resource_schema_url": obj.get("resource_schema_url"),
            "runner_group_id": obj.get("runner_group_id"),
            "runner_id": obj.get("runner_id"),
            "runner_job_execution_id": obj.get("runner_job_execution_id"),
            "runner_job_id": obj.get("runner_job_id"),
            "scope_attributes": obj.get("scope_attributes"),
            "scope_name": obj.get("scope_name"),
            "scope_schema_url": obj.get("scope_schema_url"),
            "scope_version": obj.get("scope_version"),
            "service_name": obj.get("service_name"),
            "severity_number": obj.get("severity_number"),
            "severity_text": obj.get("severity_text"),
            "span_id": obj.get("span_id"),
            "timestamp": obj.get("timestamp"),
            "timestamp_date": obj.get("timestamp_date"),
            "timestamp_time": obj.get("timestamp_time"),
            "trace_flags": obj.get("trace_flags"),
            "trace_id": obj.get("trace_id"),
            "updated_at": obj.get("updated_at")
        })
        return _obj


