from apps.core import permissions


class LiveStockCreatePermission(permissions.BasePermission):
    """ permission to create livestock """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'live_stock_create' in user_level_info['permissions']:
            return True


class LiveStockUpdatePermission(permissions.BasePermission):
    """ permission to update livestock """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'live_stock_update' in user_level_info['permissions']:
            return True


class LiveStockTrashPermission(permissions.BasePermission):
    """ permission to trash livestock """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'live_stock_trash' in user_level_info['permissions']:
            return True


class LiveStockDeletePermission(permissions.BasePermission):
    """ permission to Delete livestock """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'live_stock_delete' in user_level_info['permissions']:
            return True


class StockTypeCreatePermission(permissions.BasePermission):
    """ permission to create livestock type """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'stock_type_create' in user_level_info['permissions']:
            return True


class StockTypeUpdatePermission(permissions.BasePermission):
    """ permission to update livestock type """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'stock_type_update' in user_level_info['permissions']:
            return True


class StockTypeTrashPermission(permissions.BasePermission):
    """ permission to trash livestock type """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'stock_type_trash' in user_level_info['permissions']:
            return True


class StockTypeDeletePermission(permissions.BasePermission):
    """ permission to delete livestock type """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'stock_type_delete' in user_level_info['permissions']:
            return True


class StockUseTypeCreatePermission(permissions.BasePermission):
    """ permission to create livestock use type """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'stock_use_type_create' in user_level_info['permissions']:
            return True


class StockUseTypeUpdatePermission(permissions.BasePermission):
    """ permission to update livestock use type """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'stock_use_type_update' in user_level_info['permissions']:
            return True


class StockUseTypeTrashPermission(permissions.BasePermission):
    """ permission to trash livestock use type """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'stock_use_type_trash' in user_level_info['permissions']:
            return True


class StockUseTypeDeletePermission(permissions.BasePermission):
    """ permission to delete livestock use type """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'stock_use_type_delete' in user_level_info['permissions']:
            return True


class StockSpeciesCreatePermission(permissions.BasePermission):
    """ permission to create livestock species """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'stock_species_create' in user_level_info['permissions']:
            return True


class StockSpeciesUpdatePermission(permissions.BasePermission):
    """ permission to update livestock species """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'stock_species_update' in user_level_info['permissions']:
            return True


class StockSpeciesTrashPermission(permissions.BasePermission):
    """ permission to trash livestock species """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'stock_species_trash' in user_level_info['permissions']:
            return True


class StockSpeciesDeletePermission(permissions.BasePermission):
    """ permission to delete livestock species """

    def has_permission(self, request, view):
        user_level_info = self.get_user_permissions(request, view)
        if 'stock_species_delete' in user_level_info['permissions']:
            return True
