"""This module holds the filters for the ``apiv2`` module of ``trainings`` app"""

from django_filters import DateTimeFromToRangeFilter
from rest_framework import filters

from mtp.apps.trainings.models import TrainingSession


class SessionFilter(filters.FilterSet):
    """Filter session list by start_date range, state and/or permissions

    Attributes
    ----------
    start_date: ``django_filters.DateTimeFromToRangeFilter``
        The filter for start_date range

    """

    start_date = DateTimeFromToRangeFilter()

    class Meta:
        model = TrainingSession
        fields = ['start_date', 'state', 'permissions']
