from django_filters import rest_framework as filters

from . import models


class BookingFilter(filters.FilterSet):
    min_date = filters.DateFilter(field_name="date", lookup_expr='gte', label='开始日期')
    max_date = filters.DateFilter(field_name="date", lookup_expr='lte', label='结束日期')
    min_time = filters.TimeFilter(field_name='start_time', lookup_expr='gte', label='开始时间')
    max_time = filters.TimeFilter(field_name='end_time', lookup_expr='lte', label='结束时间')
    room = filters.UUIDFilter(field_name='room')
    status = filters.CharFilter(field_name='status')

    class Meta:
        model = models.Booking
        fields = ['min_date', 'max_date', 'min_time', 'max_time', 'room', 'status']
