# coding: utf-8

"""
    Identity Security Cloud V2025 API

    Use these APIs to interact with the Identity Security Cloud platform to achieve repeatable, automated processes with greater scalability. We encourage you to join the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss to connect with other developers using our APIs.

    The version of the OpenAPI document: v2025
    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
import warnings

from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from sailpoint.v2025.models.crawl_resources_sizes_options import CrawlResourcesSizesOptions
from typing import Optional, Set
from typing_extensions import Self

class ApplicationCrawlerSettings(BaseModel):
    """
    ApplicationCrawlerSettings
    """ # noqa: E501
    is_enabled: Optional[StrictBool] = Field(default=False, description="Indicates whether the feature or configuration is enabled.", alias="isEnabled")
    cluster_id: Optional[StrictStr] = Field(default=None, description="The identifier of the cluster associated with this configuration, if applicable.", alias="clusterId")
    calculate_resource_size: Optional[CrawlResourcesSizesOptions] = Field(default=None, alias="calculateResourceSize")
    crawl_snapshots_folder: Optional[StrictBool] = Field(default=False, description="Indicates whether to crawl the snapshots folder.", alias="crawlSnapshotsFolder")
    crawl_mailboxes: Optional[StrictBool] = Field(default=False, description="Indicates whether to crawl mailboxes.", alias="crawlMailboxes")
    crawl_public_folders: Optional[StrictBool] = Field(default=False, description="Indicates whether to crawl public folders.", alias="crawlPublicFolders")
    excluded_paths_by_regex: Optional[StrictStr] = Field(default=None, description="Regular expression pattern for paths to exclude from crawling.", alias="excludedPathsByRegex")
    crawl_top_level_shares: Optional[List[StrictStr]] = Field(default=None, description="List of top-level shares to crawl.", alias="crawlTopLevelShares")
    excluded_resources: Optional[List[StrictStr]] = Field(default=None, description="List of resource identifiers to exclude from crawling.", alias="excludedResources")
    include_resources: Optional[List[StrictStr]] = Field(default=None, description="List of resource identifiers to include in crawling.", alias="includeResources")
    __properties: ClassVar[List[str]] = ["isEnabled", "clusterId", "calculateResourceSize", "crawlSnapshotsFolder", "crawlMailboxes", "crawlPublicFolders", "excludedPathsByRegex", "crawlTopLevelShares", "excludedResources", "includeResources"]

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "isEnabled": obj.get("isEnabled") if obj.get("isEnabled") is not None else False,
            "clusterId": obj.get("clusterId"),
            "calculateResourceSize": obj.get("calculateResourceSize"),
            "crawlSnapshotsFolder": obj.get("crawlSnapshotsFolder") if obj.get("crawlSnapshotsFolder") is not None else False,
            "crawlMailboxes": obj.get("crawlMailboxes") if obj.get("crawlMailboxes") is not None else False,
            "crawlPublicFolders": obj.get("crawlPublicFolders") if obj.get("crawlPublicFolders") is not None else False,
            "excludedPathsByRegex": obj.get("excludedPathsByRegex"),
            "crawlTopLevelShares": obj.get("crawlTopLevelShares"),
            "excludedResources": obj.get("excludedResources"),
            "includeResources": obj.get("includeResources")
        })
        return _obj


