from apps.master import models as master_models
from apps.master.filters import insurance_filters
from apps.master.serializers import insurance_serializers
from base.permissions import IsAdminToAllowCRUD
from base.views import BaseModelViewSet



class InsuranceCompanyModelViewSet(BaseModelViewSet):
    """
    A viewset for handling CRUD operations on InsuranceCompanyMaster instances.

    This viewset supports the standard CRUD operations - Create, Retrieve,
    Update, and Delete - for the InsuranceCompanyMaster model.

    Attributes:
        permission_classes (tuple): A tuple of permission classes.
        serializer_class: The serializer class for the InsuranceCompanyMaster model.
        queryset: The queryset containing all InsuranceCompanyMaster instances.
        filterset_class: The filterset class for supporting custom filtering.
        http_method_names (list): List of HTTP methods allowed on this viewset.
    """

    permission_classes = (IsAdminToAllowCRUD,)
    serializer_class = insurance_serializers.InsuranceCompanyMasterSerializers
    queryset = master_models.InsuranceCompanyMaster.objects.all()
    filterset_class = insurance_filters.InsuranceCompanyListFilter
    http_method_names = ["get", "post", "patch", "delete"]


class InsuranceTypeModelViewSet(BaseModelViewSet):
    """
    A viewset for handling CRUD operations on InsuranceTypeMaster instances.

    This viewset supports the standard CRUD operations - Create, Retrieve,
    Update, and Delete - for the InsuranceTypeMaster model.

    Attributes:
        permission_classes (tuple): A tuple of permission classes.
        serializer_class: The serializer class for the InsuranceTypeMaster model.
        queryset: The queryset containing all InsuranceTypeMaster instances.
        filterset_class: The filterset class for supporting custom filtering.
        http_method_names (list): List of HTTP methods allowed on this viewset.
    """

    permission_classes = (IsAdminToAllowCRUD,)
    serializer_class = insurance_serializers.InsuranceTypeMasterSerializers
    queryset = master_models.InsuranceTypeMaster.objects.all()
    filterset_class = insurance_filters.InsuranceTypeListFilter
    http_method_names = ["get", "post", "patch", "delete"]

