# coding: utf-8

"""
    CustomerBillingService

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

    The version of the OpenAPI document: 1.0.0
    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 pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union, Set
from openapi_client.models.billing.insertion_order_pending_changes_status import InsertionOrderPendingChangesStatus
from typing_extensions import Self

class InsertionOrderPendingChanges(BaseModel):
    """
    InsertionOrderPendingChanges
    """ # noqa: E501
    comment: Optional[StrictStr] = Field(default=None, alias="Comment")
    end_date: Optional[datetime] = Field(default=None, alias="EndDate")
    requested_by_user_id: Optional[StrictInt] = Field(default=None, alias="RequestedByUserId")
    modified_date_time: Optional[datetime] = Field(default=None, alias="ModifiedDateTime")
    notification_threshold: Optional[StrictFloat] = Field(default=None, alias="NotificationThreshold")
    reference_id: Optional[StrictStr] = Field(default=None, alias="ReferenceId")
    spend_cap_amount: Optional[StrictFloat] = Field(default=None, alias="SpendCapAmount")
    start_date: Optional[datetime] = Field(default=None, alias="StartDate")
    name: Optional[StrictStr] = Field(default=None, alias="Name")
    purchase_order: Optional[StrictStr] = Field(default=None, alias="PurchaseOrder")
    change_status: Optional[InsertionOrderPendingChangesStatus] = Field(default=None, alias="ChangeStatus")
    __properties: ClassVar[List[str]] = ["Comment", "EndDate", "RequestedByUserId", "ModifiedDateTime", "NotificationThreshold", "ReferenceId", "SpendCapAmount", "StartDate", "Name", "PurchaseOrder", "ChangeStatus"]

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

    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,
        )
        # set to None if comment (nullable) is None
        # and model_fields_set contains the field
        if self.comment is None and "comment" in self.model_fields_set:
            _dict['Comment'] = None

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

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

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "Comment": obj.get("Comment") if obj.get("Comment") is not None else None,
                        "EndDate": obj.get("EndDate") if obj.get("EndDate") is not None else None,
                        "RequestedByUserId": obj.get("RequestedByUserId") if obj.get("RequestedByUserId") is not None else None,
                        "ModifiedDateTime": obj.get("ModifiedDateTime") if obj.get("ModifiedDateTime") is not None else None,
                        "NotificationThreshold": obj.get("NotificationThreshold") if obj.get("NotificationThreshold") is not None else None,
                        "ReferenceId": obj.get("ReferenceId") if obj.get("ReferenceId") is not None else None,
                        "SpendCapAmount": obj.get("SpendCapAmount") if obj.get("SpendCapAmount") is not None else None,
                        "StartDate": obj.get("StartDate") if obj.get("StartDate") is not None else None,
                        "Name": obj.get("Name") if obj.get("Name") is not None else None,
                        "PurchaseOrder": obj.get("PurchaseOrder") if obj.get("PurchaseOrder") is not None else None,
                        "ChangeStatus": obj.get("ChangeStatus") if obj.get("ChangeStatus") is not None else None
        })
        return _obj
