# coding: utf-8

"""
    Google Drive API

    The Google Drive API allows clients to access resources from Google Drive.

    The version of the OpenAPI document: v3
    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, StrictBool
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class DriveCapabilities(BaseModel):
    """
    Output only. Capabilities the current user has on this shared drive.
    """ # noqa: E501
    can_add_children: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can add children to folders in this shared drive.", alias="canAddChildren")
    can_change_copy_requires_writer_permission_restriction: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can change the `copyRequiresWriterPermission` restriction of this shared drive.", alias="canChangeCopyRequiresWriterPermissionRestriction")
    can_change_domain_users_only_restriction: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can change the `domainUsersOnly` restriction of this shared drive.", alias="canChangeDomainUsersOnlyRestriction")
    can_change_drive_background: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can change the background of this shared drive.", alias="canChangeDriveBackground")
    can_change_drive_members_only_restriction: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can change the `driveMembersOnly` restriction of this shared drive.", alias="canChangeDriveMembersOnlyRestriction")
    can_change_sharing_folders_requires_organizer_permission_restriction: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can change the `sharingFoldersRequiresOrganizerPermission` restriction of this shared drive.", alias="canChangeSharingFoldersRequiresOrganizerPermissionRestriction")
    can_comment: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can comment on files in this shared drive.", alias="canComment")
    can_copy: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can copy files in this shared drive.", alias="canCopy")
    can_delete_children: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can delete children from folders in this shared drive.", alias="canDeleteChildren")
    can_delete_drive: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can delete this shared drive. Attempting to delete the shared drive may still fail if there are untrashed items inside the shared drive.", alias="canDeleteDrive")
    can_download: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can download files in this shared drive.", alias="canDownload")
    can_edit: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can edit files in this shared drive", alias="canEdit")
    can_list_children: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can list the children of folders in this shared drive.", alias="canListChildren")
    can_manage_members: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can add members to this shared drive or remove them or change their role.", alias="canManageMembers")
    can_read_revisions: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can read the revisions resource of files in this shared drive.", alias="canReadRevisions")
    can_rename: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can rename files or folders in this shared drive.", alias="canRename")
    can_rename_drive: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can rename this shared drive.", alias="canRenameDrive")
    can_reset_drive_restrictions: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can reset the shared drive restrictions to defaults.", alias="canResetDriveRestrictions")
    can_share: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can share files or folders in this shared drive.", alias="canShare")
    can_trash_children: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can trash children from folders in this shared drive.", alias="canTrashChildren")
    __properties: ClassVar[List[str]] = ["canAddChildren", "canChangeCopyRequiresWriterPermissionRestriction", "canChangeDomainUsersOnlyRestriction", "canChangeDriveBackground", "canChangeDriveMembersOnlyRestriction", "canChangeSharingFoldersRequiresOrganizerPermissionRestriction", "canComment", "canCopy", "canDeleteChildren", "canDeleteDrive", "canDownload", "canEdit", "canListChildren", "canManageMembers", "canReadRevisions", "canRename", "canRenameDrive", "canResetDriveRestrictions", "canShare", "canTrashChildren"]

    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 DriveCapabilities 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,
        )
        return _dict

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

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

        _obj = cls.model_validate({
            "canAddChildren": obj.get("canAddChildren"),
            "canChangeCopyRequiresWriterPermissionRestriction": obj.get("canChangeCopyRequiresWriterPermissionRestriction"),
            "canChangeDomainUsersOnlyRestriction": obj.get("canChangeDomainUsersOnlyRestriction"),
            "canChangeDriveBackground": obj.get("canChangeDriveBackground"),
            "canChangeDriveMembersOnlyRestriction": obj.get("canChangeDriveMembersOnlyRestriction"),
            "canChangeSharingFoldersRequiresOrganizerPermissionRestriction": obj.get("canChangeSharingFoldersRequiresOrganizerPermissionRestriction"),
            "canComment": obj.get("canComment"),
            "canCopy": obj.get("canCopy"),
            "canDeleteChildren": obj.get("canDeleteChildren"),
            "canDeleteDrive": obj.get("canDeleteDrive"),
            "canDownload": obj.get("canDownload"),
            "canEdit": obj.get("canEdit"),
            "canListChildren": obj.get("canListChildren"),
            "canManageMembers": obj.get("canManageMembers"),
            "canReadRevisions": obj.get("canReadRevisions"),
            "canRename": obj.get("canRename"),
            "canRenameDrive": obj.get("canRenameDrive"),
            "canResetDriveRestrictions": obj.get("canResetDriveRestrictions"),
            "canShare": obj.get("canShare"),
            "canTrashChildren": obj.get("canTrashChildren")
        })
        return _obj


