# coding=utf-8

import django_filters

from .models import VehicleDriveReserve, VehicleInquiry, UsedVehicleInquiry, UsedVehicleEstimate,InsurConsultation


class VehicleDriveReserveFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(field_name='name', lookup_expr='icontains')
    tel = django_filters.CharFilter(field_name='tel', lookup_expr='icontains')
    shop = django_filters.CharFilter(field_name='shop')
    status = django_filters.CharFilter(field_name='status')
    id = django_filters.CharFilter(field_name='id')
    customer = django_filters.CharFilter(field_name='customer')

    class Meta:
        model = VehicleDriveReserve
        fields = '__all__'


class VehicleInquiryFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(field_name='name', lookup_expr='icontains')
    tel = django_filters.CharFilter(field_name='tel', lookup_expr='icontains')
    shop = django_filters.CharFilter(field_name='shop')
    status = django_filters.CharFilter(field_name='status')
    id = django_filters.CharFilter(field_name='id')
    customer = django_filters.CharFilter(field_name='customer')

    class Meta:
        model = VehicleInquiry
        fields = '__all__'


class UsedVehicleInquiryFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(field_name='name', lookup_expr='icontains')
    tel = django_filters.CharFilter(field_name='customer__tel', lookup_expr='icontains')
    brand = django_filters.CharFilter(field_name='brand')
    status = django_filters.CharFilter(field_name='status')
    id = django_filters.CharFilter(field_name='id')
    customer = django_filters.CharFilter(field_name='customer')

    class Meta:
        model = UsedVehicleInquiry
        fields = '__all__'


class UsedVehicleEstimateFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(field_name='customer__name', lookup_expr='icontains')
    tel = django_filters.CharFilter(field_name='customer__tel', lookup_expr='icontains')
    brand = django_filters.CharFilter(field_name='brand')
    shop = django_filters.CharFilter(field_name='shop')
    status = django_filters.CharFilter(field_name='status')
    id = django_filters.CharFilter(field_name='id')
    customer = django_filters.CharFilter(field_name='customer')

    class Meta:
        model = UsedVehicleEstimate
        fields = '__all__'

class InsurConsultationFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(field_name='name', lookup_expr='icontains')
    tel = django_filters.CharFilter(field_name='tel', lookup_expr='icontains')
    shop = django_filters.CharFilter(field_name='shop')
    status = django_filters.CharFilter(field_name='status')
    id = django_filters.CharFilter(field_name='id')
    customer = django_filters.CharFilter(field_name='customer')

    class Meta:
        model = InsurConsultation
        fields = '__all__'


