# 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 FileCapabilities(BaseModel):
    """
    Output only. Capabilities the current user has on this file. Each capability corresponds to a fine-grained action that a user may take.
    """ # noqa: E501
    can_accept_ownership: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user is the pending owner of the file. Not populated for shared drive files.", alias="canAcceptOwnership")
    can_add_children: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can add children to this folder. This is always false when the item is not a folder.", alias="canAddChildren")
    can_add_folder_from_another_drive: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can add a folder from another drive (different shared drive or My Drive) to this folder. This is false when the item is not a folder. Only populated for items in shared drives.", alias="canAddFolderFromAnotherDrive")
    can_add_my_drive_parent: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can add a parent for the item without removing an existing parent in the same request. Not populated for shared drive files.", alias="canAddMyDriveParent")
    can_change_copy_requires_writer_permission: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can change the `copyRequiresWriterPermission` restriction of this file.", alias="canChangeCopyRequiresWriterPermission")
    can_change_security_update_enabled: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can change the securityUpdateEnabled field on link share metadata.", alias="canChangeSecurityUpdateEnabled")
    can_change_viewers_can_copy_content: Optional[StrictBool] = Field(default=None, description="Deprecated: Output only.", alias="canChangeViewersCanCopyContent")
    can_comment: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can comment on this file.", alias="canComment")
    can_copy: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can copy this file. For an item in a shared drive, whether the current user can copy non-folder descendants of this item, or this item itself if it is not a folder.", alias="canCopy")
    can_delete: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can delete this file.", alias="canDelete")
    can_delete_children: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can delete children of this folder. This is false when the item is not a folder. Only populated for items in shared drives.", alias="canDeleteChildren")
    can_download: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can download this file.", alias="canDownload")
    can_edit: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can edit this file. Other factors may limit the type of changes a user can make to a file. For example, see `canChangeCopyRequiresWriterPermission` or `canModifyContent`.", alias="canEdit")
    can_list_children: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can list the children of this folder. This is always false when the item is not a folder.", alias="canListChildren")
    can_modify_content: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can modify the content of this file.", alias="canModifyContent")
    can_modify_content_restriction: Optional[StrictBool] = Field(default=None, description="Deprecated: Output only. Use one of `canModifyEditorContentRestriction`, `canModifyOwnerContentRestriction` or `canRemoveContentRestriction`.", alias="canModifyContentRestriction")
    can_modify_editor_content_restriction: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can add or modify content restrictions on the file which are editor restricted.", alias="canModifyEditorContentRestriction")
    can_modify_labels: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can modify the labels on the file.", alias="canModifyLabels")
    can_modify_owner_content_restriction: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can add or modify content restrictions which are owner restricted.", alias="canModifyOwnerContentRestriction")
    can_move_children_out_of_drive: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can move children of this folder outside of the shared drive. This is false when the item is not a folder. Only populated for items in shared drives.", alias="canMoveChildrenOutOfDrive")
    can_move_children_out_of_team_drive: Optional[StrictBool] = Field(default=None, description="Deprecated: Output only. Use `canMoveChildrenOutOfDrive` instead.", alias="canMoveChildrenOutOfTeamDrive")
    can_move_children_within_drive: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can move children of this folder within this drive. This is false when the item is not a folder. Note that a request to move the child may still fail depending on the current user's access to the child and to the destination folder.", alias="canMoveChildrenWithinDrive")
    can_move_children_within_team_drive: Optional[StrictBool] = Field(default=None, description="Deprecated: Output only. Use `canMoveChildrenWithinDrive` instead.", alias="canMoveChildrenWithinTeamDrive")
    can_move_item_into_team_drive: Optional[StrictBool] = Field(default=None, description="Deprecated: Output only. Use `canMoveItemOutOfDrive` instead.", alias="canMoveItemIntoTeamDrive")
    can_move_item_out_of_drive: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can move this item outside of this drive by changing its parent. Note that a request to change the parent of the item may still fail depending on the new parent that is being added.", alias="canMoveItemOutOfDrive")
    can_move_item_out_of_team_drive: Optional[StrictBool] = Field(default=None, description="Deprecated: Output only. Use `canMoveItemOutOfDrive` instead.", alias="canMoveItemOutOfTeamDrive")
    can_move_item_within_drive: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can move this item within this drive. Note that a request to change the parent of the item may still fail depending on the new parent that is being added and the parent that is being removed.", alias="canMoveItemWithinDrive")
    can_move_item_within_team_drive: Optional[StrictBool] = Field(default=None, description="Deprecated: Output only. Use `canMoveItemWithinDrive` instead.", alias="canMoveItemWithinTeamDrive")
    can_move_team_drive_item: Optional[StrictBool] = Field(default=None, description="Deprecated: Output only. Use `canMoveItemWithinDrive` or `canMoveItemOutOfDrive` instead.", alias="canMoveTeamDriveItem")
    can_read_drive: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can read the shared drive to which this file belongs. Only populated for items in shared drives.", alias="canReadDrive")
    can_read_labels: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can read the labels on the file.", alias="canReadLabels")
    can_read_revisions: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can read the revisions resource of this file. For a shared drive item, whether revisions of non-folder descendants of this item, or this item itself if it is not a folder, can be read.", alias="canReadRevisions")
    can_read_team_drive: Optional[StrictBool] = Field(default=None, description="Deprecated: Output only. Use `canReadDrive` instead.", alias="canReadTeamDrive")
    can_remove_children: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can remove children from this folder. This is always false when the item is not a folder. For a folder in a shared drive, use `canDeleteChildren` or `canTrashChildren` instead.", alias="canRemoveChildren")
    can_remove_content_restriction: Optional[StrictBool] = Field(default=None, description="Output only. Whether there is a content restriction on the file that can be removed by the current user.", alias="canRemoveContentRestriction")
    can_remove_my_drive_parent: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can remove a parent from the item without adding another parent in the same request. Not populated for shared drive files.", alias="canRemoveMyDriveParent")
    can_rename: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can rename this file.", alias="canRename")
    can_share: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can modify the sharing settings for this file.", alias="canShare")
    can_trash: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can move this file to trash.", alias="canTrash")
    can_trash_children: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can trash children of this folder. This is false when the item is not a folder. Only populated for items in shared drives.", alias="canTrashChildren")
    can_untrash: Optional[StrictBool] = Field(default=None, description="Output only. Whether the current user can restore this file from trash.", alias="canUntrash")
    __properties: ClassVar[List[str]] = ["canAcceptOwnership", "canAddChildren", "canAddFolderFromAnotherDrive", "canAddMyDriveParent", "canChangeCopyRequiresWriterPermission", "canChangeSecurityUpdateEnabled", "canChangeViewersCanCopyContent", "canComment", "canCopy", "canDelete", "canDeleteChildren", "canDownload", "canEdit", "canListChildren", "canModifyContent", "canModifyContentRestriction", "canModifyEditorContentRestriction", "canModifyLabels", "canModifyOwnerContentRestriction", "canMoveChildrenOutOfDrive", "canMoveChildrenOutOfTeamDrive", "canMoveChildrenWithinDrive", "canMoveChildrenWithinTeamDrive", "canMoveItemIntoTeamDrive", "canMoveItemOutOfDrive", "canMoveItemOutOfTeamDrive", "canMoveItemWithinDrive", "canMoveItemWithinTeamDrive", "canMoveTeamDriveItem", "canReadDrive", "canReadLabels", "canReadRevisions", "canReadTeamDrive", "canRemoveChildren", "canRemoveContentRestriction", "canRemoveMyDriveParent", "canRename", "canShare", "canTrash", "canTrashChildren", "canUntrash"]

    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 FileCapabilities 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 FileCapabilities from a dict"""
        if obj is None:
            return None

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

        _obj = cls.model_validate({
            "canAcceptOwnership": obj.get("canAcceptOwnership"),
            "canAddChildren": obj.get("canAddChildren"),
            "canAddFolderFromAnotherDrive": obj.get("canAddFolderFromAnotherDrive"),
            "canAddMyDriveParent": obj.get("canAddMyDriveParent"),
            "canChangeCopyRequiresWriterPermission": obj.get("canChangeCopyRequiresWriterPermission"),
            "canChangeSecurityUpdateEnabled": obj.get("canChangeSecurityUpdateEnabled"),
            "canChangeViewersCanCopyContent": obj.get("canChangeViewersCanCopyContent"),
            "canComment": obj.get("canComment"),
            "canCopy": obj.get("canCopy"),
            "canDelete": obj.get("canDelete"),
            "canDeleteChildren": obj.get("canDeleteChildren"),
            "canDownload": obj.get("canDownload"),
            "canEdit": obj.get("canEdit"),
            "canListChildren": obj.get("canListChildren"),
            "canModifyContent": obj.get("canModifyContent"),
            "canModifyContentRestriction": obj.get("canModifyContentRestriction"),
            "canModifyEditorContentRestriction": obj.get("canModifyEditorContentRestriction"),
            "canModifyLabels": obj.get("canModifyLabels"),
            "canModifyOwnerContentRestriction": obj.get("canModifyOwnerContentRestriction"),
            "canMoveChildrenOutOfDrive": obj.get("canMoveChildrenOutOfDrive"),
            "canMoveChildrenOutOfTeamDrive": obj.get("canMoveChildrenOutOfTeamDrive"),
            "canMoveChildrenWithinDrive": obj.get("canMoveChildrenWithinDrive"),
            "canMoveChildrenWithinTeamDrive": obj.get("canMoveChildrenWithinTeamDrive"),
            "canMoveItemIntoTeamDrive": obj.get("canMoveItemIntoTeamDrive"),
            "canMoveItemOutOfDrive": obj.get("canMoveItemOutOfDrive"),
            "canMoveItemOutOfTeamDrive": obj.get("canMoveItemOutOfTeamDrive"),
            "canMoveItemWithinDrive": obj.get("canMoveItemWithinDrive"),
            "canMoveItemWithinTeamDrive": obj.get("canMoveItemWithinTeamDrive"),
            "canMoveTeamDriveItem": obj.get("canMoveTeamDriveItem"),
            "canReadDrive": obj.get("canReadDrive"),
            "canReadLabels": obj.get("canReadLabels"),
            "canReadRevisions": obj.get("canReadRevisions"),
            "canReadTeamDrive": obj.get("canReadTeamDrive"),
            "canRemoveChildren": obj.get("canRemoveChildren"),
            "canRemoveContentRestriction": obj.get("canRemoveContentRestriction"),
            "canRemoveMyDriveParent": obj.get("canRemoveMyDriveParent"),
            "canRename": obj.get("canRename"),
            "canShare": obj.get("canShare"),
            "canTrash": obj.get("canTrash"),
            "canTrashChildren": obj.get("canTrashChildren"),
            "canUntrash": obj.get("canUntrash")
        })
        return _obj


