from api_graphql.abc.mutation_abc import MutationABC
from service.permission.permissions_enum import Permissions


class Mutation(MutationABC):
    def __init__(self):
        MutationABC.__init__(self, "")

        self.add_mutation_type(
            "apiKey",
            "ApiKey",
            require_any_permission=[
                Permissions.api_keys_create,
                Permissions.api_keys_update,
                Permissions.api_keys_delete,
            ],
        )
        self.add_mutation_type(
            "role",
            "Role",
            require_any_permission=[
                Permissions.roles_create,
                Permissions.roles_update,
                Permissions.roles_delete,
            ],
        )
        self.add_mutation_type(
            "user",
            "User",
            require_any_permission=[
                Permissions.users_update,
                Permissions.users_delete,
            ],
        )

        self.add_mutation_type(
            "domain",
            "Domain",
            require_any_permission=[
                Permissions.domains_create,
                Permissions.domains_update,
                Permissions.domains_delete,
            ],
        )
        self.add_mutation_type(
            "group",
            "Group",
            require_any_permission=[
                Permissions.groups_create,
                Permissions.groups_update,
                Permissions.groups_delete,
            ],
        )
        self.add_mutation_type(
            "shortUrl",
            "ShortUrl",
            require_any_permission=[
                Permissions.short_urls_create,
                Permissions.short_urls_update,
                Permissions.short_urls_delete,
            ],
        )
