from __future__ import annotations

from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, TypeVar

from attrs import define as _attrs_define
from attrs import field as _attrs_field

from ..types import UNSET, Unset

if TYPE_CHECKING:
    from ..models.sync_config_box_item import SyncConfigBoxItem
    from ..models.sync_config_desktop_item import SyncConfigDesktopItem
    from ..models.sync_config_dropbox_item import SyncConfigDropboxItem
    from ..models.sync_config_egnyte_item import SyncConfigEgnyteItem
    from ..models.sync_config_googledrive_item import SyncConfigGoogledriveItem
    from ..models.sync_config_onedrive_item import SyncConfigOnedriveItem
    from ..models.sync_config_pensionpro_item import SyncConfigPensionproItem
    from ..models.sync_config_sharefile_item import SyncConfigSharefileItem
    from ..models.sync_config_sharepoint_item import SyncConfigSharepointItem
    from ..models.sync_config_smartvault_item import SyncConfigSmartvaultItem


T = TypeVar("T", bound="SyncConfig")


@_attrs_define
class SyncConfig:
    """Synchronization configuration for various cloud storage providers

    Attributes:
        pensionpro (list[SyncConfigPensionproItem] | Unset):
        box (list[SyncConfigBoxItem] | Unset):
        dropbox (list[SyncConfigDropboxItem] | Unset):
        googledrive (list[SyncConfigGoogledriveItem] | Unset):
        onedrive (list[SyncConfigOnedriveItem] | Unset):
        sharepoint (list[SyncConfigSharepointItem] | Unset):
        smartvault (list[SyncConfigSmartvaultItem] | Unset):
        egnyte (list[SyncConfigEgnyteItem] | Unset):
        sharefile (list[SyncConfigSharefileItem] | Unset):
        desktop (list[SyncConfigDesktopItem] | Unset):
    """

    pensionpro: list[SyncConfigPensionproItem] | Unset = UNSET
    box: list[SyncConfigBoxItem] | Unset = UNSET
    dropbox: list[SyncConfigDropboxItem] | Unset = UNSET
    googledrive: list[SyncConfigGoogledriveItem] | Unset = UNSET
    onedrive: list[SyncConfigOnedriveItem] | Unset = UNSET
    sharepoint: list[SyncConfigSharepointItem] | Unset = UNSET
    smartvault: list[SyncConfigSmartvaultItem] | Unset = UNSET
    egnyte: list[SyncConfigEgnyteItem] | Unset = UNSET
    sharefile: list[SyncConfigSharefileItem] | Unset = UNSET
    desktop: list[SyncConfigDesktopItem] | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

    def to_dict(self) -> dict[str, Any]:
        pensionpro: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.pensionpro, Unset):
            pensionpro = []
            for pensionpro_item_data in self.pensionpro:
                pensionpro_item = pensionpro_item_data.to_dict()
                pensionpro.append(pensionpro_item)

        box: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.box, Unset):
            box = []
            for box_item_data in self.box:
                box_item = box_item_data.to_dict()
                box.append(box_item)

        dropbox: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.dropbox, Unset):
            dropbox = []
            for dropbox_item_data in self.dropbox:
                dropbox_item = dropbox_item_data.to_dict()
                dropbox.append(dropbox_item)

        googledrive: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.googledrive, Unset):
            googledrive = []
            for googledrive_item_data in self.googledrive:
                googledrive_item = googledrive_item_data.to_dict()
                googledrive.append(googledrive_item)

        onedrive: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.onedrive, Unset):
            onedrive = []
            for onedrive_item_data in self.onedrive:
                onedrive_item = onedrive_item_data.to_dict()
                onedrive.append(onedrive_item)

        sharepoint: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.sharepoint, Unset):
            sharepoint = []
            for sharepoint_item_data in self.sharepoint:
                sharepoint_item = sharepoint_item_data.to_dict()
                sharepoint.append(sharepoint_item)

        smartvault: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.smartvault, Unset):
            smartvault = []
            for smartvault_item_data in self.smartvault:
                smartvault_item = smartvault_item_data.to_dict()
                smartvault.append(smartvault_item)

        egnyte: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.egnyte, Unset):
            egnyte = []
            for egnyte_item_data in self.egnyte:
                egnyte_item = egnyte_item_data.to_dict()
                egnyte.append(egnyte_item)

        sharefile: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.sharefile, Unset):
            sharefile = []
            for sharefile_item_data in self.sharefile:
                sharefile_item = sharefile_item_data.to_dict()
                sharefile.append(sharefile_item)

        desktop: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.desktop, Unset):
            desktop = []
            for desktop_item_data in self.desktop:
                desktop_item = desktop_item_data.to_dict()
                desktop.append(desktop_item)

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if pensionpro is not UNSET:
            field_dict["pensionpro"] = pensionpro
        if box is not UNSET:
            field_dict["box"] = box
        if dropbox is not UNSET:
            field_dict["dropbox"] = dropbox
        if googledrive is not UNSET:
            field_dict["googledrive"] = googledrive
        if onedrive is not UNSET:
            field_dict["onedrive"] = onedrive
        if sharepoint is not UNSET:
            field_dict["sharepoint"] = sharepoint
        if smartvault is not UNSET:
            field_dict["smartvault"] = smartvault
        if egnyte is not UNSET:
            field_dict["egnyte"] = egnyte
        if sharefile is not UNSET:
            field_dict["sharefile"] = sharefile
        if desktop is not UNSET:
            field_dict["desktop"] = desktop

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        from ..models.sync_config_box_item import SyncConfigBoxItem
        from ..models.sync_config_desktop_item import SyncConfigDesktopItem
        from ..models.sync_config_dropbox_item import SyncConfigDropboxItem
        from ..models.sync_config_egnyte_item import SyncConfigEgnyteItem
        from ..models.sync_config_googledrive_item import SyncConfigGoogledriveItem
        from ..models.sync_config_onedrive_item import SyncConfigOnedriveItem
        from ..models.sync_config_pensionpro_item import SyncConfigPensionproItem
        from ..models.sync_config_sharefile_item import SyncConfigSharefileItem
        from ..models.sync_config_sharepoint_item import SyncConfigSharepointItem
        from ..models.sync_config_smartvault_item import SyncConfigSmartvaultItem

        d = dict(src_dict)
        _pensionpro = d.pop("pensionpro", UNSET)
        pensionpro: list[SyncConfigPensionproItem] | Unset = UNSET
        if _pensionpro is not UNSET:
            pensionpro = []
            for pensionpro_item_data in _pensionpro:
                pensionpro_item = SyncConfigPensionproItem.from_dict(pensionpro_item_data)

                pensionpro.append(pensionpro_item)

        _box = d.pop("box", UNSET)
        box: list[SyncConfigBoxItem] | Unset = UNSET
        if _box is not UNSET:
            box = []
            for box_item_data in _box:
                box_item = SyncConfigBoxItem.from_dict(box_item_data)

                box.append(box_item)

        _dropbox = d.pop("dropbox", UNSET)
        dropbox: list[SyncConfigDropboxItem] | Unset = UNSET
        if _dropbox is not UNSET:
            dropbox = []
            for dropbox_item_data in _dropbox:
                dropbox_item = SyncConfigDropboxItem.from_dict(dropbox_item_data)

                dropbox.append(dropbox_item)

        _googledrive = d.pop("googledrive", UNSET)
        googledrive: list[SyncConfigGoogledriveItem] | Unset = UNSET
        if _googledrive is not UNSET:
            googledrive = []
            for googledrive_item_data in _googledrive:
                googledrive_item = SyncConfigGoogledriveItem.from_dict(googledrive_item_data)

                googledrive.append(googledrive_item)

        _onedrive = d.pop("onedrive", UNSET)
        onedrive: list[SyncConfigOnedriveItem] | Unset = UNSET
        if _onedrive is not UNSET:
            onedrive = []
            for onedrive_item_data in _onedrive:
                onedrive_item = SyncConfigOnedriveItem.from_dict(onedrive_item_data)

                onedrive.append(onedrive_item)

        _sharepoint = d.pop("sharepoint", UNSET)
        sharepoint: list[SyncConfigSharepointItem] | Unset = UNSET
        if _sharepoint is not UNSET:
            sharepoint = []
            for sharepoint_item_data in _sharepoint:
                sharepoint_item = SyncConfigSharepointItem.from_dict(sharepoint_item_data)

                sharepoint.append(sharepoint_item)

        _smartvault = d.pop("smartvault", UNSET)
        smartvault: list[SyncConfigSmartvaultItem] | Unset = UNSET
        if _smartvault is not UNSET:
            smartvault = []
            for smartvault_item_data in _smartvault:
                smartvault_item = SyncConfigSmartvaultItem.from_dict(smartvault_item_data)

                smartvault.append(smartvault_item)

        _egnyte = d.pop("egnyte", UNSET)
        egnyte: list[SyncConfigEgnyteItem] | Unset = UNSET
        if _egnyte is not UNSET:
            egnyte = []
            for egnyte_item_data in _egnyte:
                egnyte_item = SyncConfigEgnyteItem.from_dict(egnyte_item_data)

                egnyte.append(egnyte_item)

        _sharefile = d.pop("sharefile", UNSET)
        sharefile: list[SyncConfigSharefileItem] | Unset = UNSET
        if _sharefile is not UNSET:
            sharefile = []
            for sharefile_item_data in _sharefile:
                sharefile_item = SyncConfigSharefileItem.from_dict(sharefile_item_data)

                sharefile.append(sharefile_item)

        _desktop = d.pop("desktop", UNSET)
        desktop: list[SyncConfigDesktopItem] | Unset = UNSET
        if _desktop is not UNSET:
            desktop = []
            for desktop_item_data in _desktop:
                desktop_item = SyncConfigDesktopItem.from_dict(desktop_item_data)

                desktop.append(desktop_item)

        sync_config = cls(
            pensionpro=pensionpro,
            box=box,
            dropbox=dropbox,
            googledrive=googledrive,
            onedrive=onedrive,
            sharepoint=sharepoint,
            smartvault=smartvault,
            egnyte=egnyte,
            sharefile=sharefile,
            desktop=desktop,
        )

        sync_config.additional_properties = d
        return sync_config

    @property
    def additional_keys(self) -> list[str]:
        return list(self.additional_properties.keys())

    def __getitem__(self, key: str) -> Any:
        return self.additional_properties[key]

    def __setitem__(self, key: str, value: Any) -> None:
        self.additional_properties[key] = value

    def __delitem__(self, key: str) -> None:
        del self.additional_properties[key]

    def __contains__(self, key: str) -> bool:
        return key in self.additional_properties
