from apps.calls.models import Call

from apps.calls.constants import BotType
from apps.appointments.models import Appointment


class BDCCallsService:

    @staticmethod
    def fetch_calls(company, start_date=None, end_date=None):
        if not company:
            return Call.objects.none()

        all_calls = Call.objects.filter(
            transfer_number=company.bdc_number,
            company=company,
            created_at__gte=start_date,
            created_at__lte=end_date,
            bot_type=BotType.SERVICE_BOT.value
        )

        return all_calls
