"""
_____________________________________________________________________.

:PROJECT: LARAsuite

*lara_django_myproj gRPC services*

:details: lara_django_myproj gRPC services.
         -
:authors: mark doerr <mark.doerr@uni-greifswald.de>

.. note:: -
.. todo:: -
________________________________________________________________________
"""

## generated with django-socio-grpc generateprpcinterface lara_django_material  (LARA-version)

import lara_django_material_grpc.v1.lara_django_material_pb2 as lara_django_material_pb2
from django_socio_grpc import generics, mixins
from lara_django_base.grpc.mixins import AsyncDownloadModelMixin, AsyncRetrieveByNameModelMixin, AsyncUploadModelMixin

from lara_django_material.models import (
    Device,
    DeviceSetup,
    DeviceSetupShape,
    DeviceSetupsSubset,
    DeviceShape,
    DevicesSubset,
    ExtraData,
    Labware,
    LabwareClass,
    LabwareShape,
    LabwareSubset,
    Part,
    PartDeviceClass,
    PartShape,
    PartsSubset,
    WellShape,
)

from ..filters import (
    DeviceFilterSet,
    DeviceSetupFilterSet,
    DeviceSetupShapeFilterSet,
    DeviceShapeFilterSet,
    ExtraDataFilterSet,
    LabwareClassFilterSet,
    LabwareFilterSet,
    LabwareShapeFilterSet,
    PartDeviceClassFilterSet,
    PartFilterSet,
    PartShapeFilterSet,
    WellShapeFilterSet,
)
from .serializers import (
    DeviceProtoSerializer,
    DeviceSetupProtoSerializer,
    DeviceSetupShapeProtoSerializer,
    DeviceSetupsSubsetProtoSerializer,
    DeviceShapeProtoSerializer,
    DevicesSubsetProtoSerializer,
    ExtraDataProtoSerializer,
    LabwareClassProtoSerializer,
    LabwareProtoSerializer,
    LabwareShapeProtoSerializer,
    LabwareSubsetProtoSerializer,
    PartDeviceClassByNameProtoSerializer,
    PartDeviceClassProtoSerializer,
    PartProtoSerializer,
    PartShapeProtoSerializer,
    PartsSubsetProtoSerializer,
    WellShapeProtoSerializer,
)


class ExtraDataService(generics.AsyncModelService, mixins.AsyncStreamModelMixin):
    """ExtraDataService class."""

    queryset = ExtraData.objects.all()
    serializer_class = ExtraDataProtoSerializer
    filterset_class = ExtraDataFilterSet
    search_fields = ["name", "description"]


class PartDeviceClassService(generics.AsyncModelService, mixins.AsyncStreamModelMixin):
    """PartDeviceClassService class."""

    queryset = PartDeviceClass.objects.all()
    serializer_class = PartDeviceClassProtoSerializer
    filterset_class = PartDeviceClassFilterSet
    search_fields = ["name", "description"]


class PartDeviceClassByNameService(
    generics.GenericService,
    mixins.AsyncListModelMixin,
    AsyncUploadModelMixin,
    AsyncRetrieveByNameModelMixin,
    AsyncDownloadModelMixin,
):
    """PartDeviceClassByNameService class."""

    pb2 = lara_django_material_pb2
    queryset = PartDeviceClass.objects.all().order_by("name")
    serializer_class = PartDeviceClassByNameProtoSerializer
    filterset_class = PartDeviceClassFilterSet

    lookup_field = "name"


class PartShapeService(generics.AsyncModelService, mixins.AsyncStreamModelMixin):
    """PartShapeService class."""

    queryset = PartShape.objects.all()
    serializer_class = PartShapeProtoSerializer
    filterset_class = PartShapeFilterSet
    search_fields = ["name", "description"]


class PartService(
    generics.AsyncModelService,
    mixins.AsyncStreamModelMixin,
    AsyncUploadModelMixin,
    AsyncRetrieveByNameModelMixin,
    AsyncDownloadModelMixin,
):
    """PartService class."""

    pb2 = lara_django_material_pb2
    queryset = Part.objects.all()
    serializer_class = PartProtoSerializer
    filterset_class = PartFilterSet
    search_fields = ["name", "description"]


# class PartByNameService(generics.GenericService, mixins.AsyncListModelMixin, mixins.AsyncRetrieveModelMixin):
#     queryset = Part.objects.all().order_by("name")
#     serializer_class = PartByNameProtoSerializer
#     filterset_class = PartFilterSet

#     lookup_field = "name"


class PartsSubsetService(generics.AsyncModelService, mixins.AsyncStreamModelMixin):
    """PartsSubsetService class."""

    queryset = PartsSubset.objects.all()
    serializer_class = PartsSubsetProtoSerializer
    search_fields = ["name", "description"]


class DeviceShapeService(generics.AsyncModelService, mixins.AsyncStreamModelMixin):
    """DeviceShapeService class."""

    queryset = DeviceShape.objects.all()
    serializer_class = DeviceShapeProtoSerializer
    filterset_class = DeviceShapeFilterSet
    search_fields = ["name", "description"]


class DeviceService(
    generics.AsyncModelService,
    mixins.AsyncStreamModelMixin,
    AsyncUploadModelMixin,
    AsyncRetrieveByNameModelMixin,
    AsyncDownloadModelMixin,
):
    """DeviceService class."""

    pb2 = lara_django_material_pb2
    queryset = Device.objects.all()
    serializer_class = DeviceProtoSerializer
    filterset_class = DeviceFilterSet
    search_fields = ["name", "description"]


# class DeviceByNameService(generics.GenericService, mixins.AsyncListModelMixin, mixins.AsyncRetrieveModelMixin):
#     queryset = Device.objects.all().order_by("name")
#     serializer_class = DeviceByNameProtoSerializer
#     filterset_class = DeviceFilterSet

#     lookup_field = "name"


class DevicesSubsetService(generics.AsyncModelService, mixins.AsyncStreamModelMixin):
    """DevicesSubsetService class."""

    queryset = DevicesSubset.objects.all()
    serializer_class = DevicesSubsetProtoSerializer
    search_fields = ["name", "description"]


class DeviceSetupShapeService(generics.AsyncModelService, mixins.AsyncStreamModelMixin):
    """DeviceSetupShapeService class."""

    queryset = DeviceSetupShape.objects.all()
    serializer_class = DeviceSetupShapeProtoSerializer
    filterset_class = DeviceSetupShapeFilterSet
    search_fields = ["name", "description"]


class DeviceSetupService(
    generics.AsyncModelService,
    mixins.AsyncStreamModelMixin,
    AsyncUploadModelMixin,
    AsyncRetrieveByNameModelMixin,
    AsyncDownloadModelMixin,
):
    """DeviceSetupService class."""

    pb2 = lara_django_material_pb2
    queryset = DeviceSetup.objects.all()
    serializer_class = DeviceSetupProtoSerializer
    filterset_class = DeviceSetupFilterSet
    search_fields = ["name", "description"]


# class DeviceSetupByNameService(generics.GenericService, mixins.AsyncListModelMixin, mixins.AsyncRetrieveModelMixin):
#     queryset = DeviceSetup.objects.all().order_by("name")
#     serializer_class = DeviceSetupByNameProtoSerializer
#     filterset_class = DeviceSetupFilterSet

#     lookup_field = "name"


class DeviceSetupsSubsetService(generics.AsyncModelService, mixins.AsyncStreamModelMixin):
    """DeviceSetupsSubsetService class."""

    queryset = DeviceSetupsSubset.objects.all()
    serializer_class = DeviceSetupsSubsetProtoSerializer
    search_fields = ["name", "description"]


class LabwareClassService(generics.AsyncModelService, mixins.AsyncStreamModelMixin):
    """LabwareClassService class."""

    queryset = LabwareClass.objects.all()
    serializer_class = LabwareClassProtoSerializer
    filterset_class = LabwareClassFilterSet
    search_fields = ["name", "description"]


class WellShapeService(generics.AsyncModelService, mixins.AsyncStreamModelMixin):
    """WellShapeService class."""

    queryset = WellShape.objects.all()
    serializer_class = WellShapeProtoSerializer
    filterset_class = WellShapeFilterSet
    search_fields = ["name", "description"]


class LabwareShapeService(generics.AsyncModelService, mixins.AsyncStreamModelMixin):
    """LabwareShapeService class."""

    queryset = LabwareShape.objects.all()
    serializer_class = LabwareShapeProtoSerializer
    filterset_class = LabwareShapeFilterSet
    search_fields = ["name", "description"]


class LabwareService(
    generics.AsyncModelService,
    mixins.AsyncStreamModelMixin,
    AsyncUploadModelMixin,
    AsyncRetrieveByNameModelMixin,
    AsyncDownloadModelMixin,
):
    """LabwareService class."""

    pb2 = lara_django_material_pb2
    queryset = Labware.objects.all()
    serializer_class = LabwareProtoSerializer
    filterset_class = LabwareFilterSet
    search_fields = ["name", "description"]


# class LabwareByNameService(generics.GenericService, mixins.AsyncListModelMixin, mixins.AsyncRetrieveModelMixin):
#     queryset = Labware.objects.all().order_by("name")
#     serializer_class = LabwareByNameProtoSerializer
#     filterset_class = LabwareFilterSet

#     lookup_field = "name"


class LabwareSubsetService(generics.AsyncModelService, mixins.AsyncStreamModelMixin):
    """LabwareSubsetService class."""

    queryset = LabwareSubset.objects.all()
    serializer_class = LabwareSubsetProtoSerializer
    search_fields = ["name", "description"]
