"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""

from __future__ import annotations
import dataclasses
import requests as requests_http
from ...models.components import calldetail as components_calldetail
from enum import Enum
from typing import List, Optional

class CallType(str, Enum):
    INBOUND_PHONE_CALL = 'inbound_phone_call'
    OUTBOUND_PHONE_CALL = 'outbound_phone_call'
    WEB_CALL = 'web_call'


@dataclasses.dataclass
class FilterCriteria:
    after_end_timestamp: Optional[int] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'after_end_timestamp' }})
    r"""Inclusive. Filter calls that end on or after this timestamp."""
    after_start_timestamp: Optional[int] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'after_start_timestamp' }})
    r"""Inclusive. Filter calls that start on or after this timestamp."""
    agent_id: Optional[List[str]] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'agent_id' }})
    r"""Only retrieve calls that are made with specific agent(s)."""
    before_end_timestamp: Optional[int] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'before_end_timestamp' }})
    r"""Exclusive. Filter calls that end before this timestamp."""
    before_start_timestamp: Optional[int] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'before_start_timestamp' }})
    r"""Exclusive. Filter calls that start before this timestamp."""
    call_type: Optional[List[CallType]] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'call_type' }})
    r"""Only retrieve calls of specific type(s)."""
    


class SortOrder(str, Enum):
    r"""The calls will be sorted by `start_timestamp`, whether to return the calls in ascending or descending order."""
    ASCENDING = 'ascending'
    DESCENDING = 'descending'


@dataclasses.dataclass
class ListCallsRequest:
    filter_criteria: Optional[FilterCriteria] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'filter_criteria', 'style': 'form', 'explode': True }})
    limit: Optional[int] = dataclasses.field(default=1000, metadata={'query_param': { 'field_name': 'limit', 'style': 'form', 'explode': True }})
    r"""Limit the number of calls returned."""
    sort_order: Optional[SortOrder] = dataclasses.field(default=SortOrder.DESCENDING, metadata={'query_param': { 'field_name': 'sort_order', 'style': 'form', 'explode': True }})
    r"""The calls will be sorted by `start_timestamp`, whether to return the calls in ascending or descending order."""
    



@dataclasses.dataclass
class ListCallsResponse:
    content_type: str = dataclasses.field()
    r"""HTTP response content type for this operation"""
    raw_response: requests_http.Response = dataclasses.field()
    r"""Raw HTTP response; suitable for custom response parsing"""
    status_code: int = dataclasses.field()
    r"""HTTP response status code for this operation"""
    calls: Optional[List[components_calldetail.CallDetail]] = dataclasses.field(default=None)
    r"""Successfully retrieved all agents."""
    

