# This file was auto-generated by Fern from our API Definition.

import typing

from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.pagination import AsyncPager, SyncPager
from ..core.request_options import RequestOptions
from ..types.create_driver_request_attributes import CreateDriverRequestAttributes
from ..types.driver import Driver
from ..types.driver_carrier_settings import DriverCarrierSettings
from ..types.driver_has_driving_features_hidden import DriverHasDrivingFeaturesHidden
from ..types.driver_has_vehicle_unpinning_enabled import DriverHasVehicleUnpinningEnabled
from ..types.driver_hos_setting import DriverHosSetting
from ..types.driver_profile_image_base_64 import DriverProfileImageBase64
from ..types.driver_profile_image_url import DriverProfileImageUrl
from ..types.driver_remote_signout_post_driver_remote_signout_response_body import (
    DriverRemoteSignoutPostDriverRemoteSignoutResponseBody,
)
from ..types.driver_response import DriverResponse
from ..types.list_drivers_response import ListDriversResponse
from ..types.update_driver_request_attributes import UpdateDriverRequestAttributes
from ..types.update_driver_request_hos_setting import UpdateDriverRequestHosSetting
from ..types.us_driver_ruleset_override import UsDriverRulesetOverride
from .raw_client import AsyncRawDriversClient, RawDriversClient
from .types.create_driver_request_locale import CreateDriverRequestLocale
from .types.list_drivers_request_driver_activation_status import ListDriversRequestDriverActivationStatus
from .types.update_driver_request_driver_activation_status import UpdateDriverRequestDriverActivationStatus
from .types.update_driver_request_locale import UpdateDriverRequestLocale

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class DriversClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawDriversClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> RawDriversClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawDriversClient
        """
        return self._raw_client

    def list(
        self,
        *,
        driver_activation_status: typing.Optional[ListDriversRequestDriverActivationStatus] = None,
        limit: typing.Optional[int] = None,
        after: typing.Optional[str] = None,
        parent_tag_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        tag_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        attribute_value_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        attributes: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        updated_after_time: typing.Optional[str] = None,
        created_after_time: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SyncPager[Driver, ListDriversResponse]:
        """
        Get all drivers in organization.

         **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

        To use this endpoint, select **Read Drivers** under the Drivers category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>

        Parameters
        ----------
        driver_activation_status : typing.Optional[ListDriversRequestDriverActivationStatus]
            If value is `deactivated`, only drivers that are deactivated will appear in the response. This parameter will default to `active` if not provided (fetching only active drivers).

        limit : typing.Optional[int]
            The limit for how many objects will be in the response. Default and max for this value is 512 objects.

        after : typing.Optional[str]
            If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results.

        parent_tag_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            A filter on the data based on this comma-separated list of parent tag IDs, for use by orgs with tag hierarchies. Specifying a parent tag will implicitly include all descendent tags of the parent tag. Example: `parentTagIds=345,678`

        tag_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            A filter on the data based on this comma-separated list of tag IDs. Example: `tagIds=1234,5678`

        attribute_value_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            A filter on the data based on this comma-separated list of attribute value IDs. Only entities associated with ALL of the referenced values will be returned (i.e. the intersection of the sets of entities with each value). Example: `attributeValueIds=076efac2-83b5-47aa-ba36-18428436dcac,6707b3f0-23b9-4fe3-b7be-11be34aea544`

        attributes : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            A filter on the data to return entities having given attributes using name-value pair or range query (only for numeric attributes), separated by semicolon. Only entities associated with ALL of the referenced values will be returned (i.e. the intersection of the sets of entities with each value). Example: `attributes=ExampleAttributeName:some_value&attributes=SomeOtherAttr:123&attributes=someNumericAttribute:range(10,20)`

        updated_after_time : typing.Optional[str]
            A filter on data to have an updated at time after or equal to this specified time in RFC 3339 format. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00).

        created_after_time : typing.Optional[str]
            A filter on data to have a created at time after or equal to this specified time in RFC 3339 format. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00).

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        SyncPager[Driver, ListDriversResponse]
            List of all driver objects.

        Examples
        --------
        from samsara import Samsara

        client = Samsara(
            token="YOUR_TOKEN",
        )
        response = client.drivers.list()
        for item in response:
            yield item
        # alternatively, you can paginate page-by-page
        for page in response.iter_pages():
            yield page
        """
        return self._raw_client.list(
            driver_activation_status=driver_activation_status,
            limit=limit,
            after=after,
            parent_tag_ids=parent_tag_ids,
            tag_ids=tag_ids,
            attribute_value_ids=attribute_value_ids,
            attributes=attributes,
            updated_after_time=updated_after_time,
            created_after_time=created_after_time,
            request_options=request_options,
        )

    def create(
        self,
        *,
        name: str,
        password: str,
        username: str,
        attributes: typing.Optional[typing.Sequence[CreateDriverRequestAttributes]] = OMIT,
        carrier_settings: typing.Optional[DriverCarrierSettings] = OMIT,
        current_id_card_code: typing.Optional[str] = OMIT,
        eld_adverse_weather_exemption_enabled: typing.Optional[bool] = OMIT,
        eld_big_day_exemption_enabled: typing.Optional[bool] = OMIT,
        eld_day_start_hour: typing.Optional[int] = OMIT,
        eld_exempt: typing.Optional[bool] = OMIT,
        eld_exempt_reason: typing.Optional[str] = OMIT,
        eld_pc_enabled: typing.Optional[bool] = OMIT,
        eld_ym_enabled: typing.Optional[bool] = OMIT,
        external_ids: typing.Optional[typing.Dict[str, str]] = OMIT,
        has_driving_features_hidden: typing.Optional[DriverHasDrivingFeaturesHidden] = OMIT,
        has_vehicle_unpinning_enabled: typing.Optional[DriverHasVehicleUnpinningEnabled] = OMIT,
        hos_setting: typing.Optional[DriverHosSetting] = OMIT,
        license_number: typing.Optional[str] = OMIT,
        license_state: typing.Optional[str] = OMIT,
        locale: typing.Optional[CreateDriverRequestLocale] = OMIT,
        notes: typing.Optional[str] = OMIT,
        peer_group_tag_id: typing.Optional[str] = OMIT,
        phone: typing.Optional[str] = OMIT,
        profile_image_base_64: typing.Optional[DriverProfileImageBase64] = OMIT,
        profile_image_url: typing.Optional[DriverProfileImageUrl] = OMIT,
        static_assigned_vehicle_id: typing.Optional[str] = OMIT,
        tachograph_card_number: typing.Optional[str] = OMIT,
        tag_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        timezone: typing.Optional[str] = OMIT,
        us_driver_ruleset_override: typing.Optional[UsDriverRulesetOverride] = OMIT,
        vehicle_group_tag_id: typing.Optional[str] = OMIT,
        waiting_time_duty_status_enabled: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> DriverResponse:
        """
        Add a driver to the organization.

         **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

        To use this endpoint, select **Write Drivers** under the Drivers category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>

        Parameters
        ----------
        name : str
            Driver's name.

        password : str
            Password that the driver can use to login to the Samsara driver app.

        username : str
            Driver's login username into the driver app. The username may not contain spaces or the '@' symbol. The username must be unique.

        attributes : typing.Optional[typing.Sequence[CreateDriverRequestAttributes]]

        carrier_settings : typing.Optional[DriverCarrierSettings]

        current_id_card_code : typing.Optional[str]
            The ID Card Code on the back of the physical card assigned to the driver.  Contact Samsara if you would like to enable this feature.

        eld_adverse_weather_exemption_enabled : typing.Optional[bool]
            Flag indicating this driver may use Adverse Weather exemptions in ELD logs.

        eld_big_day_exemption_enabled : typing.Optional[bool]
            Flag indicating this driver may use Big Day exemption in ELD logs.

        eld_day_start_hour : typing.Optional[int]
            `0` indicating midnight-to-midnight ELD driving hours, `12` to indicate noon-to-noon driving hours.

        eld_exempt : typing.Optional[bool]
            Flag indicating this driver is exempt from the Electronic Logging Mandate.

        eld_exempt_reason : typing.Optional[str]
            Reason that this driver is exempt from the Electronic Logging Mandate (see eldExempt).

        eld_pc_enabled : typing.Optional[bool]
            Flag indicating this driver may select the Personal Conveyance duty status in ELD logs.

        eld_ym_enabled : typing.Optional[bool]
            Flag indicating this driver may select the Yard Move duty status in ELD logs.

        external_ids : typing.Optional[typing.Dict[str, str]]
            The [external IDs](https://developers.samsara.com/docs/external-ids) for the given object.

        has_driving_features_hidden : typing.Optional[DriverHasDrivingFeaturesHidden]

        has_vehicle_unpinning_enabled : typing.Optional[DriverHasVehicleUnpinningEnabled]

        hos_setting : typing.Optional[DriverHosSetting]

        license_number : typing.Optional[str]
            Driver's state issued license number. The combination of this number and `licenseState` must be unique.

        license_state : typing.Optional[str]
            Abbreviation of US state, Canadian province, or US territory that issued driver's license.

        locale : typing.Optional[CreateDriverRequestLocale]
            Locale override (uncommon). These are specified by ISO 3166-2 country codes for supported locales. Valid values: `us`, `at`, `be`, `ca`, `gb`, `fr`, `de`, `ie`, `it`, `lu`, `mx`, `nl`, `es`, `ch`, `pr`.

        notes : typing.Optional[str]
            Notes about the driver.

        peer_group_tag_id : typing.Optional[str]
            The peer group tag id this driver belong to, used for gamification.

        phone : typing.Optional[str]
            Phone number of the driver.

        profile_image_base_64 : typing.Optional[DriverProfileImageBase64]

        profile_image_url : typing.Optional[DriverProfileImageUrl]

        static_assigned_vehicle_id : typing.Optional[str]
            ID of vehicle that the driver is permanently assigned to. (uncommon).

        tachograph_card_number : typing.Optional[str]
            Driver's assigned tachograph card number (Europe specific)

        tag_ids : typing.Optional[typing.Sequence[str]]
            IDs of tags the driver is associated with. If your access to the API is scoped by one or more tags, this field is required to pass in.

        timezone : typing.Optional[str]
            Home terminal timezone, in order to indicate what time zone should be used to calculate the ELD logs. Driver timezones use [IANA timezone database](https://www.iana.org/time-zones) keys (e.g. `America/Los_Angeles`, `America/New_York`, `Europe/London`, etc.). You can find a mapping of common timezone formats to IANA timezone keys [here](https://unicode.org/cldr/charts/latest/supplemental/zone_tzid.html).

        us_driver_ruleset_override : typing.Optional[UsDriverRulesetOverride]

        vehicle_group_tag_id : typing.Optional[str]
            Tag ID which determines which vehicles a driver will see when selecting vehicles.

        waiting_time_duty_status_enabled : typing.Optional[bool]
            Flag indicating this driver may select waiting time duty status in ELD logs

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DriverResponse
            Newly created driver object, with Samsara-generated ID.

        Examples
        --------
        from samsara import Samsara

        client = Samsara(
            token="YOUR_TOKEN",
        )
        client.drivers.create(
            name="Susan Jones",
            password="aSecurePassword1234",
            username="SusanJones",
        )
        """
        _response = self._raw_client.create(
            name=name,
            password=password,
            username=username,
            attributes=attributes,
            carrier_settings=carrier_settings,
            current_id_card_code=current_id_card_code,
            eld_adverse_weather_exemption_enabled=eld_adverse_weather_exemption_enabled,
            eld_big_day_exemption_enabled=eld_big_day_exemption_enabled,
            eld_day_start_hour=eld_day_start_hour,
            eld_exempt=eld_exempt,
            eld_exempt_reason=eld_exempt_reason,
            eld_pc_enabled=eld_pc_enabled,
            eld_ym_enabled=eld_ym_enabled,
            external_ids=external_ids,
            has_driving_features_hidden=has_driving_features_hidden,
            has_vehicle_unpinning_enabled=has_vehicle_unpinning_enabled,
            hos_setting=hos_setting,
            license_number=license_number,
            license_state=license_state,
            locale=locale,
            notes=notes,
            peer_group_tag_id=peer_group_tag_id,
            phone=phone,
            profile_image_base_64=profile_image_base_64,
            profile_image_url=profile_image_url,
            static_assigned_vehicle_id=static_assigned_vehicle_id,
            tachograph_card_number=tachograph_card_number,
            tag_ids=tag_ids,
            timezone=timezone,
            us_driver_ruleset_override=us_driver_ruleset_override,
            vehicle_group_tag_id=vehicle_group_tag_id,
            waiting_time_duty_status_enabled=waiting_time_duty_status_enabled,
            request_options=request_options,
        )
        return _response.data

    def post_driver_remote_signout(
        self, *, driver_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> DriverRemoteSignoutPostDriverRemoteSignoutResponseBody:
        """
        Sign out a driver from the Samsara Driver App

        To access this endpoint, your organization must have the Samsara Platform Premier license.

        Note: Sign out requests made while a logged-in driver does not have internet connection will not log the driver out. A success response will still be provided and the driver will be logged out once they have internet connection.

         <b>Rate limit:</b> 100 requests/min (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).

        To use this endpoint, select **Write Driver Remote Signout** under the Drivers category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>


         **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

        Parameters
        ----------
        driver_id : str
            ID of the driver.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DriverRemoteSignoutPostDriverRemoteSignoutResponseBody
            OK response.

        Examples
        --------
        from samsara import Samsara

        client = Samsara(
            token="YOUR_TOKEN",
        )
        client.drivers.post_driver_remote_signout(
            driver_id="12434",
        )
        """
        _response = self._raw_client.post_driver_remote_signout(driver_id=driver_id, request_options=request_options)
        return _response.data

    def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DriverResponse:
        """
        Get information about a driver.

         **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

        To use this endpoint, select **Read Drivers** under the Drivers category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>

        Parameters
        ----------
        id : str
            ID of the driver. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: `key:value`. For example, `payrollId:ABFS18600`

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DriverResponse
            Returns the specified driver.

        Examples
        --------
        from samsara import Samsara

        client = Samsara(
            token="YOUR_TOKEN",
        )
        client.drivers.get(
            id="id",
        )
        """
        _response = self._raw_client.get(id, request_options=request_options)
        return _response.data

    def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
        """
        Parameters
        ----------
        id : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from samsara import Samsara

        client = Samsara(
            token="YOUR_TOKEN",
        )
        client.drivers.delete(
            id="id",
        )
        """
        _response = self._raw_client.delete(id, request_options=request_options)
        return _response.data

    def update(
        self,
        id: str,
        *,
        attributes: typing.Optional[typing.Sequence[UpdateDriverRequestAttributes]] = OMIT,
        carrier_settings: typing.Optional[DriverCarrierSettings] = OMIT,
        current_id_card_code: typing.Optional[str] = OMIT,
        deactivated_at_time: typing.Optional[str] = OMIT,
        driver_activation_status: typing.Optional[UpdateDriverRequestDriverActivationStatus] = OMIT,
        eld_adverse_weather_exemption_enabled: typing.Optional[bool] = OMIT,
        eld_big_day_exemption_enabled: typing.Optional[bool] = OMIT,
        eld_day_start_hour: typing.Optional[int] = OMIT,
        eld_exempt: typing.Optional[bool] = OMIT,
        eld_exempt_reason: typing.Optional[str] = OMIT,
        eld_pc_enabled: typing.Optional[bool] = OMIT,
        eld_ym_enabled: typing.Optional[bool] = OMIT,
        external_ids: typing.Optional[typing.Dict[str, str]] = OMIT,
        has_driving_features_hidden: typing.Optional[DriverHasDrivingFeaturesHidden] = OMIT,
        has_vehicle_unpinning_enabled: typing.Optional[DriverHasVehicleUnpinningEnabled] = OMIT,
        hos_setting: typing.Optional[UpdateDriverRequestHosSetting] = OMIT,
        license_number: typing.Optional[str] = OMIT,
        license_state: typing.Optional[str] = OMIT,
        locale: typing.Optional[UpdateDriverRequestLocale] = OMIT,
        name: typing.Optional[str] = OMIT,
        notes: typing.Optional[str] = OMIT,
        password: typing.Optional[str] = OMIT,
        peer_group_tag_id: typing.Optional[str] = OMIT,
        phone: typing.Optional[str] = OMIT,
        profile_image_base_64: typing.Optional[DriverProfileImageBase64] = OMIT,
        profile_image_url: typing.Optional[DriverProfileImageUrl] = OMIT,
        static_assigned_vehicle_id: typing.Optional[str] = OMIT,
        tachograph_card_number: typing.Optional[str] = OMIT,
        tag_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        timezone: typing.Optional[str] = OMIT,
        us_driver_ruleset_override: typing.Optional[UsDriverRulesetOverride] = OMIT,
        username: typing.Optional[str] = OMIT,
        vehicle_group_tag_id: typing.Optional[str] = OMIT,
        waiting_time_duty_status_enabled: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> DriverResponse:
        """
        Update a specific driver's information. This can also be used to activate or de-activate a given driver by setting the driverActivationStatus field. If the driverActivationStatus field is 'deactivated' then the user can also specify the deactivatedAtTime. The deactivatedAtTime cannot be more than 6 months in the past and must not come before the dirver's latest active HOS log. It will be considered an error if deactivatedAtTime is provided with a driverActivationStatus of active.

         **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

        To use this endpoint, select **Write Drivers** under the Drivers category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>

        Parameters
        ----------
        id : str
            ID of the driver. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: `key:value`. For example, `payrollId:ABFS18600`

        attributes : typing.Optional[typing.Sequence[UpdateDriverRequestAttributes]]

        carrier_settings : typing.Optional[DriverCarrierSettings]

        current_id_card_code : typing.Optional[str]
            The ID Card Code on the back of the physical card assigned to the driver.  Contact Samsara if you would like to enable this feature.

        deactivated_at_time : typing.Optional[str]
            The date and time this driver is considered to be deactivated in RFC 3339 format.

        driver_activation_status : typing.Optional[UpdateDriverRequestDriverActivationStatus]
            A value indicating whether the driver is active or deactivated. Valid values: `active`, `deactivated`.

        eld_adverse_weather_exemption_enabled : typing.Optional[bool]
            Flag indicating this driver may use Adverse Weather exemptions in ELD logs.

        eld_big_day_exemption_enabled : typing.Optional[bool]
            Flag indicating this driver may use Big Day exemption in ELD logs.

        eld_day_start_hour : typing.Optional[int]
            `0` indicating midnight-to-midnight ELD driving hours, `12` to indicate noon-to-noon driving hours.

        eld_exempt : typing.Optional[bool]
            Flag indicating this driver is exempt from the Electronic Logging Mandate.

        eld_exempt_reason : typing.Optional[str]
            Reason that this driver is exempt from the Electronic Logging Mandate (see eldExempt).

        eld_pc_enabled : typing.Optional[bool]
            Flag indicating this driver may select the Personal Conveyance duty status in ELD logs.

        eld_ym_enabled : typing.Optional[bool]
            Flag indicating this driver may select the Yard Move duty status in ELD logs.

        external_ids : typing.Optional[typing.Dict[str, str]]
            The [external IDs](https://developers.samsara.com/docs/external-ids) for the given object.

        has_driving_features_hidden : typing.Optional[DriverHasDrivingFeaturesHidden]

        has_vehicle_unpinning_enabled : typing.Optional[DriverHasVehicleUnpinningEnabled]

        hos_setting : typing.Optional[UpdateDriverRequestHosSetting]

        license_number : typing.Optional[str]
            Driver's state issued license number. The combination of this number and `licenseState` must be unique.

        license_state : typing.Optional[str]
            Abbreviation of US state, Canadian province, or US territory that issued driver's license.

        locale : typing.Optional[UpdateDriverRequestLocale]
            Locale override (uncommon). These are specified by ISO 3166-2 country codes for supported locales. Valid values: `us`, `at`, `be`, `ca`, `gb`, `fr`, `de`, `ie`, `it`, `lu`, `mx`, `nl`, `es`, `ch`, `pr`.

        name : typing.Optional[str]
            Driver's name.

        notes : typing.Optional[str]
            Notes about the driver.

        password : typing.Optional[str]
            Password that the driver can use to login to the Samsara driver app.

        peer_group_tag_id : typing.Optional[str]
            The peer group tag id this driver belong to, leave blank to be in group with everyone, used for gamification.

        phone : typing.Optional[str]
            Phone number of the driver.

        profile_image_base_64 : typing.Optional[DriverProfileImageBase64]

        profile_image_url : typing.Optional[DriverProfileImageUrl]

        static_assigned_vehicle_id : typing.Optional[str]
            ID of vehicle that the driver is permanently assigned to. (uncommon).

        tachograph_card_number : typing.Optional[str]
            Driver's assigned tachograph card number (Europe specific)

        tag_ids : typing.Optional[typing.Sequence[str]]
            IDs of tags the driver is associated with. If your access to the API is scoped by one or more tags, this field is required to pass in.

        timezone : typing.Optional[str]
            Home terminal timezone, in order to indicate what time zone should be used to calculate the ELD logs. Driver timezones use [IANA timezone database](https://www.iana.org/time-zones) keys (e.g. `America/Los_Angeles`, `America/New_York`, `Europe/London`, etc.). You can find a mapping of common timezone formats to IANA timezone keys [here](https://unicode.org/cldr/charts/latest/supplemental/zone_tzid.html).

        us_driver_ruleset_override : typing.Optional[UsDriverRulesetOverride]

        username : typing.Optional[str]
            Driver's login username into the driver app. The username may not contain spaces or the '@' symbol. The username must be unique.

        vehicle_group_tag_id : typing.Optional[str]
            Tag ID which determines which vehicles a driver will see when selecting vehicles.

        waiting_time_duty_status_enabled : typing.Optional[bool]
            Flag indicating this driver may select waiting time duty status in ELD logs

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DriverResponse
            Updated driver object, with ID.

        Examples
        --------
        from samsara import Samsara

        client = Samsara(
            token="YOUR_TOKEN",
        )
        client.drivers.update(
            id="id",
        )
        """
        _response = self._raw_client.update(
            id,
            attributes=attributes,
            carrier_settings=carrier_settings,
            current_id_card_code=current_id_card_code,
            deactivated_at_time=deactivated_at_time,
            driver_activation_status=driver_activation_status,
            eld_adverse_weather_exemption_enabled=eld_adverse_weather_exemption_enabled,
            eld_big_day_exemption_enabled=eld_big_day_exemption_enabled,
            eld_day_start_hour=eld_day_start_hour,
            eld_exempt=eld_exempt,
            eld_exempt_reason=eld_exempt_reason,
            eld_pc_enabled=eld_pc_enabled,
            eld_ym_enabled=eld_ym_enabled,
            external_ids=external_ids,
            has_driving_features_hidden=has_driving_features_hidden,
            has_vehicle_unpinning_enabled=has_vehicle_unpinning_enabled,
            hos_setting=hos_setting,
            license_number=license_number,
            license_state=license_state,
            locale=locale,
            name=name,
            notes=notes,
            password=password,
            peer_group_tag_id=peer_group_tag_id,
            phone=phone,
            profile_image_base_64=profile_image_base_64,
            profile_image_url=profile_image_url,
            static_assigned_vehicle_id=static_assigned_vehicle_id,
            tachograph_card_number=tachograph_card_number,
            tag_ids=tag_ids,
            timezone=timezone,
            us_driver_ruleset_override=us_driver_ruleset_override,
            username=username,
            vehicle_group_tag_id=vehicle_group_tag_id,
            waiting_time_duty_status_enabled=waiting_time_duty_status_enabled,
            request_options=request_options,
        )
        return _response.data


class AsyncDriversClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawDriversClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> AsyncRawDriversClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawDriversClient
        """
        return self._raw_client

    async def list(
        self,
        *,
        driver_activation_status: typing.Optional[ListDriversRequestDriverActivationStatus] = None,
        limit: typing.Optional[int] = None,
        after: typing.Optional[str] = None,
        parent_tag_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        tag_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        attribute_value_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        attributes: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        updated_after_time: typing.Optional[str] = None,
        created_after_time: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncPager[Driver, ListDriversResponse]:
        """
        Get all drivers in organization.

         **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

        To use this endpoint, select **Read Drivers** under the Drivers category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>

        Parameters
        ----------
        driver_activation_status : typing.Optional[ListDriversRequestDriverActivationStatus]
            If value is `deactivated`, only drivers that are deactivated will appear in the response. This parameter will default to `active` if not provided (fetching only active drivers).

        limit : typing.Optional[int]
            The limit for how many objects will be in the response. Default and max for this value is 512 objects.

        after : typing.Optional[str]
            If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results.

        parent_tag_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            A filter on the data based on this comma-separated list of parent tag IDs, for use by orgs with tag hierarchies. Specifying a parent tag will implicitly include all descendent tags of the parent tag. Example: `parentTagIds=345,678`

        tag_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            A filter on the data based on this comma-separated list of tag IDs. Example: `tagIds=1234,5678`

        attribute_value_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            A filter on the data based on this comma-separated list of attribute value IDs. Only entities associated with ALL of the referenced values will be returned (i.e. the intersection of the sets of entities with each value). Example: `attributeValueIds=076efac2-83b5-47aa-ba36-18428436dcac,6707b3f0-23b9-4fe3-b7be-11be34aea544`

        attributes : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            A filter on the data to return entities having given attributes using name-value pair or range query (only for numeric attributes), separated by semicolon. Only entities associated with ALL of the referenced values will be returned (i.e. the intersection of the sets of entities with each value). Example: `attributes=ExampleAttributeName:some_value&attributes=SomeOtherAttr:123&attributes=someNumericAttribute:range(10,20)`

        updated_after_time : typing.Optional[str]
            A filter on data to have an updated at time after or equal to this specified time in RFC 3339 format. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00).

        created_after_time : typing.Optional[str]
            A filter on data to have a created at time after or equal to this specified time in RFC 3339 format. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00).

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncPager[Driver, ListDriversResponse]
            List of all driver objects.

        Examples
        --------
        import asyncio

        from samsara import AsyncSamsara

        client = AsyncSamsara(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            response = await client.drivers.list()
            async for item in response:
                yield item

            # alternatively, you can paginate page-by-page
            async for page in response.iter_pages():
                yield page


        asyncio.run(main())
        """
        return await self._raw_client.list(
            driver_activation_status=driver_activation_status,
            limit=limit,
            after=after,
            parent_tag_ids=parent_tag_ids,
            tag_ids=tag_ids,
            attribute_value_ids=attribute_value_ids,
            attributes=attributes,
            updated_after_time=updated_after_time,
            created_after_time=created_after_time,
            request_options=request_options,
        )

    async def create(
        self,
        *,
        name: str,
        password: str,
        username: str,
        attributes: typing.Optional[typing.Sequence[CreateDriverRequestAttributes]] = OMIT,
        carrier_settings: typing.Optional[DriverCarrierSettings] = OMIT,
        current_id_card_code: typing.Optional[str] = OMIT,
        eld_adverse_weather_exemption_enabled: typing.Optional[bool] = OMIT,
        eld_big_day_exemption_enabled: typing.Optional[bool] = OMIT,
        eld_day_start_hour: typing.Optional[int] = OMIT,
        eld_exempt: typing.Optional[bool] = OMIT,
        eld_exempt_reason: typing.Optional[str] = OMIT,
        eld_pc_enabled: typing.Optional[bool] = OMIT,
        eld_ym_enabled: typing.Optional[bool] = OMIT,
        external_ids: typing.Optional[typing.Dict[str, str]] = OMIT,
        has_driving_features_hidden: typing.Optional[DriverHasDrivingFeaturesHidden] = OMIT,
        has_vehicle_unpinning_enabled: typing.Optional[DriverHasVehicleUnpinningEnabled] = OMIT,
        hos_setting: typing.Optional[DriverHosSetting] = OMIT,
        license_number: typing.Optional[str] = OMIT,
        license_state: typing.Optional[str] = OMIT,
        locale: typing.Optional[CreateDriverRequestLocale] = OMIT,
        notes: typing.Optional[str] = OMIT,
        peer_group_tag_id: typing.Optional[str] = OMIT,
        phone: typing.Optional[str] = OMIT,
        profile_image_base_64: typing.Optional[DriverProfileImageBase64] = OMIT,
        profile_image_url: typing.Optional[DriverProfileImageUrl] = OMIT,
        static_assigned_vehicle_id: typing.Optional[str] = OMIT,
        tachograph_card_number: typing.Optional[str] = OMIT,
        tag_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        timezone: typing.Optional[str] = OMIT,
        us_driver_ruleset_override: typing.Optional[UsDriverRulesetOverride] = OMIT,
        vehicle_group_tag_id: typing.Optional[str] = OMIT,
        waiting_time_duty_status_enabled: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> DriverResponse:
        """
        Add a driver to the organization.

         **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

        To use this endpoint, select **Write Drivers** under the Drivers category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>

        Parameters
        ----------
        name : str
            Driver's name.

        password : str
            Password that the driver can use to login to the Samsara driver app.

        username : str
            Driver's login username into the driver app. The username may not contain spaces or the '@' symbol. The username must be unique.

        attributes : typing.Optional[typing.Sequence[CreateDriverRequestAttributes]]

        carrier_settings : typing.Optional[DriverCarrierSettings]

        current_id_card_code : typing.Optional[str]
            The ID Card Code on the back of the physical card assigned to the driver.  Contact Samsara if you would like to enable this feature.

        eld_adverse_weather_exemption_enabled : typing.Optional[bool]
            Flag indicating this driver may use Adverse Weather exemptions in ELD logs.

        eld_big_day_exemption_enabled : typing.Optional[bool]
            Flag indicating this driver may use Big Day exemption in ELD logs.

        eld_day_start_hour : typing.Optional[int]
            `0` indicating midnight-to-midnight ELD driving hours, `12` to indicate noon-to-noon driving hours.

        eld_exempt : typing.Optional[bool]
            Flag indicating this driver is exempt from the Electronic Logging Mandate.

        eld_exempt_reason : typing.Optional[str]
            Reason that this driver is exempt from the Electronic Logging Mandate (see eldExempt).

        eld_pc_enabled : typing.Optional[bool]
            Flag indicating this driver may select the Personal Conveyance duty status in ELD logs.

        eld_ym_enabled : typing.Optional[bool]
            Flag indicating this driver may select the Yard Move duty status in ELD logs.

        external_ids : typing.Optional[typing.Dict[str, str]]
            The [external IDs](https://developers.samsara.com/docs/external-ids) for the given object.

        has_driving_features_hidden : typing.Optional[DriverHasDrivingFeaturesHidden]

        has_vehicle_unpinning_enabled : typing.Optional[DriverHasVehicleUnpinningEnabled]

        hos_setting : typing.Optional[DriverHosSetting]

        license_number : typing.Optional[str]
            Driver's state issued license number. The combination of this number and `licenseState` must be unique.

        license_state : typing.Optional[str]
            Abbreviation of US state, Canadian province, or US territory that issued driver's license.

        locale : typing.Optional[CreateDriverRequestLocale]
            Locale override (uncommon). These are specified by ISO 3166-2 country codes for supported locales. Valid values: `us`, `at`, `be`, `ca`, `gb`, `fr`, `de`, `ie`, `it`, `lu`, `mx`, `nl`, `es`, `ch`, `pr`.

        notes : typing.Optional[str]
            Notes about the driver.

        peer_group_tag_id : typing.Optional[str]
            The peer group tag id this driver belong to, used for gamification.

        phone : typing.Optional[str]
            Phone number of the driver.

        profile_image_base_64 : typing.Optional[DriverProfileImageBase64]

        profile_image_url : typing.Optional[DriverProfileImageUrl]

        static_assigned_vehicle_id : typing.Optional[str]
            ID of vehicle that the driver is permanently assigned to. (uncommon).

        tachograph_card_number : typing.Optional[str]
            Driver's assigned tachograph card number (Europe specific)

        tag_ids : typing.Optional[typing.Sequence[str]]
            IDs of tags the driver is associated with. If your access to the API is scoped by one or more tags, this field is required to pass in.

        timezone : typing.Optional[str]
            Home terminal timezone, in order to indicate what time zone should be used to calculate the ELD logs. Driver timezones use [IANA timezone database](https://www.iana.org/time-zones) keys (e.g. `America/Los_Angeles`, `America/New_York`, `Europe/London`, etc.). You can find a mapping of common timezone formats to IANA timezone keys [here](https://unicode.org/cldr/charts/latest/supplemental/zone_tzid.html).

        us_driver_ruleset_override : typing.Optional[UsDriverRulesetOverride]

        vehicle_group_tag_id : typing.Optional[str]
            Tag ID which determines which vehicles a driver will see when selecting vehicles.

        waiting_time_duty_status_enabled : typing.Optional[bool]
            Flag indicating this driver may select waiting time duty status in ELD logs

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DriverResponse
            Newly created driver object, with Samsara-generated ID.

        Examples
        --------
        import asyncio

        from samsara import AsyncSamsara

        client = AsyncSamsara(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.drivers.create(
                name="Susan Jones",
                password="aSecurePassword1234",
                username="SusanJones",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create(
            name=name,
            password=password,
            username=username,
            attributes=attributes,
            carrier_settings=carrier_settings,
            current_id_card_code=current_id_card_code,
            eld_adverse_weather_exemption_enabled=eld_adverse_weather_exemption_enabled,
            eld_big_day_exemption_enabled=eld_big_day_exemption_enabled,
            eld_day_start_hour=eld_day_start_hour,
            eld_exempt=eld_exempt,
            eld_exempt_reason=eld_exempt_reason,
            eld_pc_enabled=eld_pc_enabled,
            eld_ym_enabled=eld_ym_enabled,
            external_ids=external_ids,
            has_driving_features_hidden=has_driving_features_hidden,
            has_vehicle_unpinning_enabled=has_vehicle_unpinning_enabled,
            hos_setting=hos_setting,
            license_number=license_number,
            license_state=license_state,
            locale=locale,
            notes=notes,
            peer_group_tag_id=peer_group_tag_id,
            phone=phone,
            profile_image_base_64=profile_image_base_64,
            profile_image_url=profile_image_url,
            static_assigned_vehicle_id=static_assigned_vehicle_id,
            tachograph_card_number=tachograph_card_number,
            tag_ids=tag_ids,
            timezone=timezone,
            us_driver_ruleset_override=us_driver_ruleset_override,
            vehicle_group_tag_id=vehicle_group_tag_id,
            waiting_time_duty_status_enabled=waiting_time_duty_status_enabled,
            request_options=request_options,
        )
        return _response.data

    async def post_driver_remote_signout(
        self, *, driver_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> DriverRemoteSignoutPostDriverRemoteSignoutResponseBody:
        """
        Sign out a driver from the Samsara Driver App

        To access this endpoint, your organization must have the Samsara Platform Premier license.

        Note: Sign out requests made while a logged-in driver does not have internet connection will not log the driver out. A success response will still be provided and the driver will be logged out once they have internet connection.

         <b>Rate limit:</b> 100 requests/min (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).

        To use this endpoint, select **Write Driver Remote Signout** under the Drivers category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>


         **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

        Parameters
        ----------
        driver_id : str
            ID of the driver.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DriverRemoteSignoutPostDriverRemoteSignoutResponseBody
            OK response.

        Examples
        --------
        import asyncio

        from samsara import AsyncSamsara

        client = AsyncSamsara(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.drivers.post_driver_remote_signout(
                driver_id="12434",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.post_driver_remote_signout(
            driver_id=driver_id, request_options=request_options
        )
        return _response.data

    async def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DriverResponse:
        """
        Get information about a driver.

         **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

        To use this endpoint, select **Read Drivers** under the Drivers category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>

        Parameters
        ----------
        id : str
            ID of the driver. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: `key:value`. For example, `payrollId:ABFS18600`

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DriverResponse
            Returns the specified driver.

        Examples
        --------
        import asyncio

        from samsara import AsyncSamsara

        client = AsyncSamsara(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.drivers.get(
                id="id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get(id, request_options=request_options)
        return _response.data

    async def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
        """
        Parameters
        ----------
        id : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        import asyncio

        from samsara import AsyncSamsara

        client = AsyncSamsara(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.drivers.delete(
                id="id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.delete(id, request_options=request_options)
        return _response.data

    async def update(
        self,
        id: str,
        *,
        attributes: typing.Optional[typing.Sequence[UpdateDriverRequestAttributes]] = OMIT,
        carrier_settings: typing.Optional[DriverCarrierSettings] = OMIT,
        current_id_card_code: typing.Optional[str] = OMIT,
        deactivated_at_time: typing.Optional[str] = OMIT,
        driver_activation_status: typing.Optional[UpdateDriverRequestDriverActivationStatus] = OMIT,
        eld_adverse_weather_exemption_enabled: typing.Optional[bool] = OMIT,
        eld_big_day_exemption_enabled: typing.Optional[bool] = OMIT,
        eld_day_start_hour: typing.Optional[int] = OMIT,
        eld_exempt: typing.Optional[bool] = OMIT,
        eld_exempt_reason: typing.Optional[str] = OMIT,
        eld_pc_enabled: typing.Optional[bool] = OMIT,
        eld_ym_enabled: typing.Optional[bool] = OMIT,
        external_ids: typing.Optional[typing.Dict[str, str]] = OMIT,
        has_driving_features_hidden: typing.Optional[DriverHasDrivingFeaturesHidden] = OMIT,
        has_vehicle_unpinning_enabled: typing.Optional[DriverHasVehicleUnpinningEnabled] = OMIT,
        hos_setting: typing.Optional[UpdateDriverRequestHosSetting] = OMIT,
        license_number: typing.Optional[str] = OMIT,
        license_state: typing.Optional[str] = OMIT,
        locale: typing.Optional[UpdateDriverRequestLocale] = OMIT,
        name: typing.Optional[str] = OMIT,
        notes: typing.Optional[str] = OMIT,
        password: typing.Optional[str] = OMIT,
        peer_group_tag_id: typing.Optional[str] = OMIT,
        phone: typing.Optional[str] = OMIT,
        profile_image_base_64: typing.Optional[DriverProfileImageBase64] = OMIT,
        profile_image_url: typing.Optional[DriverProfileImageUrl] = OMIT,
        static_assigned_vehicle_id: typing.Optional[str] = OMIT,
        tachograph_card_number: typing.Optional[str] = OMIT,
        tag_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        timezone: typing.Optional[str] = OMIT,
        us_driver_ruleset_override: typing.Optional[UsDriverRulesetOverride] = OMIT,
        username: typing.Optional[str] = OMIT,
        vehicle_group_tag_id: typing.Optional[str] = OMIT,
        waiting_time_duty_status_enabled: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> DriverResponse:
        """
        Update a specific driver's information. This can also be used to activate or de-activate a given driver by setting the driverActivationStatus field. If the driverActivationStatus field is 'deactivated' then the user can also specify the deactivatedAtTime. The deactivatedAtTime cannot be more than 6 months in the past and must not come before the dirver's latest active HOS log. It will be considered an error if deactivatedAtTime is provided with a driverActivationStatus of active.

         **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

        To use this endpoint, select **Write Drivers** under the Drivers category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>

        Parameters
        ----------
        id : str
            ID of the driver. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: `key:value`. For example, `payrollId:ABFS18600`

        attributes : typing.Optional[typing.Sequence[UpdateDriverRequestAttributes]]

        carrier_settings : typing.Optional[DriverCarrierSettings]

        current_id_card_code : typing.Optional[str]
            The ID Card Code on the back of the physical card assigned to the driver.  Contact Samsara if you would like to enable this feature.

        deactivated_at_time : typing.Optional[str]
            The date and time this driver is considered to be deactivated in RFC 3339 format.

        driver_activation_status : typing.Optional[UpdateDriverRequestDriverActivationStatus]
            A value indicating whether the driver is active or deactivated. Valid values: `active`, `deactivated`.

        eld_adverse_weather_exemption_enabled : typing.Optional[bool]
            Flag indicating this driver may use Adverse Weather exemptions in ELD logs.

        eld_big_day_exemption_enabled : typing.Optional[bool]
            Flag indicating this driver may use Big Day exemption in ELD logs.

        eld_day_start_hour : typing.Optional[int]
            `0` indicating midnight-to-midnight ELD driving hours, `12` to indicate noon-to-noon driving hours.

        eld_exempt : typing.Optional[bool]
            Flag indicating this driver is exempt from the Electronic Logging Mandate.

        eld_exempt_reason : typing.Optional[str]
            Reason that this driver is exempt from the Electronic Logging Mandate (see eldExempt).

        eld_pc_enabled : typing.Optional[bool]
            Flag indicating this driver may select the Personal Conveyance duty status in ELD logs.

        eld_ym_enabled : typing.Optional[bool]
            Flag indicating this driver may select the Yard Move duty status in ELD logs.

        external_ids : typing.Optional[typing.Dict[str, str]]
            The [external IDs](https://developers.samsara.com/docs/external-ids) for the given object.

        has_driving_features_hidden : typing.Optional[DriverHasDrivingFeaturesHidden]

        has_vehicle_unpinning_enabled : typing.Optional[DriverHasVehicleUnpinningEnabled]

        hos_setting : typing.Optional[UpdateDriverRequestHosSetting]

        license_number : typing.Optional[str]
            Driver's state issued license number. The combination of this number and `licenseState` must be unique.

        license_state : typing.Optional[str]
            Abbreviation of US state, Canadian province, or US territory that issued driver's license.

        locale : typing.Optional[UpdateDriverRequestLocale]
            Locale override (uncommon). These are specified by ISO 3166-2 country codes for supported locales. Valid values: `us`, `at`, `be`, `ca`, `gb`, `fr`, `de`, `ie`, `it`, `lu`, `mx`, `nl`, `es`, `ch`, `pr`.

        name : typing.Optional[str]
            Driver's name.

        notes : typing.Optional[str]
            Notes about the driver.

        password : typing.Optional[str]
            Password that the driver can use to login to the Samsara driver app.

        peer_group_tag_id : typing.Optional[str]
            The peer group tag id this driver belong to, leave blank to be in group with everyone, used for gamification.

        phone : typing.Optional[str]
            Phone number of the driver.

        profile_image_base_64 : typing.Optional[DriverProfileImageBase64]

        profile_image_url : typing.Optional[DriverProfileImageUrl]

        static_assigned_vehicle_id : typing.Optional[str]
            ID of vehicle that the driver is permanently assigned to. (uncommon).

        tachograph_card_number : typing.Optional[str]
            Driver's assigned tachograph card number (Europe specific)

        tag_ids : typing.Optional[typing.Sequence[str]]
            IDs of tags the driver is associated with. If your access to the API is scoped by one or more tags, this field is required to pass in.

        timezone : typing.Optional[str]
            Home terminal timezone, in order to indicate what time zone should be used to calculate the ELD logs. Driver timezones use [IANA timezone database](https://www.iana.org/time-zones) keys (e.g. `America/Los_Angeles`, `America/New_York`, `Europe/London`, etc.). You can find a mapping of common timezone formats to IANA timezone keys [here](https://unicode.org/cldr/charts/latest/supplemental/zone_tzid.html).

        us_driver_ruleset_override : typing.Optional[UsDriverRulesetOverride]

        username : typing.Optional[str]
            Driver's login username into the driver app. The username may not contain spaces or the '@' symbol. The username must be unique.

        vehicle_group_tag_id : typing.Optional[str]
            Tag ID which determines which vehicles a driver will see when selecting vehicles.

        waiting_time_duty_status_enabled : typing.Optional[bool]
            Flag indicating this driver may select waiting time duty status in ELD logs

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DriverResponse
            Updated driver object, with ID.

        Examples
        --------
        import asyncio

        from samsara import AsyncSamsara

        client = AsyncSamsara(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.drivers.update(
                id="id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update(
            id,
            attributes=attributes,
            carrier_settings=carrier_settings,
            current_id_card_code=current_id_card_code,
            deactivated_at_time=deactivated_at_time,
            driver_activation_status=driver_activation_status,
            eld_adverse_weather_exemption_enabled=eld_adverse_weather_exemption_enabled,
            eld_big_day_exemption_enabled=eld_big_day_exemption_enabled,
            eld_day_start_hour=eld_day_start_hour,
            eld_exempt=eld_exempt,
            eld_exempt_reason=eld_exempt_reason,
            eld_pc_enabled=eld_pc_enabled,
            eld_ym_enabled=eld_ym_enabled,
            external_ids=external_ids,
            has_driving_features_hidden=has_driving_features_hidden,
            has_vehicle_unpinning_enabled=has_vehicle_unpinning_enabled,
            hos_setting=hos_setting,
            license_number=license_number,
            license_state=license_state,
            locale=locale,
            name=name,
            notes=notes,
            password=password,
            peer_group_tag_id=peer_group_tag_id,
            phone=phone,
            profile_image_base_64=profile_image_base_64,
            profile_image_url=profile_image_url,
            static_assigned_vehicle_id=static_assigned_vehicle_id,
            tachograph_card_number=tachograph_card_number,
            tag_ids=tag_ids,
            timezone=timezone,
            us_driver_ruleset_override=us_driver_ruleset_override,
            username=username,
            vehicle_group_tag_id=vehicle_group_tag_id,
            waiting_time_duty_status_enabled=waiting_time_duty_status_enabled,
            request_options=request_options,
        )
        return _response.data
