from __future__ import annotations

from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, TypeVar, cast

from attrs import define as _attrs_define
from attrs import field as _attrs_field

from ..types import UNSET, Unset

if TYPE_CHECKING:
    from ..models.types_activity import TypesActivity
    from ..models.types_address import TypesAddress
    from ..models.types_assignee import TypesAssignee
    from ..models.types_assignee_tasks import TypesAssigneeTasks
    from ..models.types_client_contact import TypesClientContact
    from ..models.types_client_summary import TypesClientSummary
    from ..models.types_comment import TypesComment
    from ..models.types_deal import TypesDeal
    from ..models.types_efast import TypesEfast
    from ..models.types_external_contact import TypesExternalContact
    from ..models.types_field import TypesField
    from ..models.types_file import TypesFile
    from ..models.types_location import TypesLocation
    from ..models.types_meeting import TypesMeeting
    from ..models.types_message import TypesMessage
    from ..models.types_notice_progress import TypesNoticeProgress
    from ..models.types_payroll_config import TypesPayrollConfig
    from ..models.types_project import TypesProject
    from ..models.types_pulse import TypesPulse
    from ..models.types_retirement_plan import TypesRetirementPlan
    from ..models.types_task import TypesTask


T = TypeVar("T", bound="TypesClient")


@_attrs_define
class TypesClient:
    """
    Attributes:
        field_id (str | Unset):
        activity (list[TypesActivity] | Unset):
        address (list[TypesAddress] | Unset):
        allow_multiple_payrolls (bool | Unset):
        assignee_tasks (list[TypesAssigneeTasks] | Unset):
        assignees (list[TypesAssignee] | Unset):
        business_type (str | Unset): Business details
        census_status (str | Unset):
        census_task (str | Unset):
        comments (list[TypesComment] | Unset):
        contacts (list[TypesClientContact] | Unset):
        created_at (str | Unset):
        deals (list[TypesDeal] | Unset):
        deleted_at (str | Unset):
        directory (str | Unset):
        efast (TypesEfast | Unset):
        ein (str | Unset):
        employees (int | Unset):
        external (list[TypesExternalContact] | Unset):
        fields (list[TypesField] | Unset):
        fye (str | Unset): Fiscal year end
        history (list[TypesClientSummary] | Unset):
        ignore_emails (bool | Unset):
        last_follow_up (str | Unset): Automated reminders
        locations (list[TypesLocation] | Unset):
        meetings (list[TypesMeeting] | Unset):
        messages (list[TypesMessage] | Unset):
        naics_code (str | Unset):
        name (str | Unset):
        notes (str | Unset):
        notices (list[TypesNoticeProgress] | Unset):
        payroll (TypesPayrollConfig | Unset):
        phone (str | Unset):
        plans (list[TypesRetirementPlan] | Unset):
        primary_id (str | Unset):
        primary_team (str | Unset): Cross-team collaboration
            When collaborations for clients/plans are accepted, the resources are copied over to the team that accepted the
            collaboration.
            The clients/plans will have unique IDs but will be linked to the original client/plan to maintain a 2-way sync.
        primary_team_name (str | Unset): If the above properties are nil or omitted, the client/plan is owned by the
            team that created it.
        projects (list[TypesProject] | Unset):
        pulse (TypesPulse | Unset):
        pulse_total (int | Unset): For returning when loading
        shared (str | Unset):
        shared_folders (list[TypesFile] | Unset):
        status (str | Unset):
        suggested_tasks (list[str] | Unset):
        summary (list[str] | Unset):
        summary_for_client (list[str] | Unset):
        summary_stale (bool | Unset):
        tags (list[str] | Unset):
        tasks (list[TypesTask] | Unset):
        team (str | Unset):
        total_value (float | Unset):
        view (str | Unset):
        website (str | Unset):
        won_value (float | Unset): Calculated values
    """

    field_id: str | Unset = UNSET
    activity: list[TypesActivity] | Unset = UNSET
    address: list[TypesAddress] | Unset = UNSET
    allow_multiple_payrolls: bool | Unset = UNSET
    assignee_tasks: list[TypesAssigneeTasks] | Unset = UNSET
    assignees: list[TypesAssignee] | Unset = UNSET
    business_type: str | Unset = UNSET
    census_status: str | Unset = UNSET
    census_task: str | Unset = UNSET
    comments: list[TypesComment] | Unset = UNSET
    contacts: list[TypesClientContact] | Unset = UNSET
    created_at: str | Unset = UNSET
    deals: list[TypesDeal] | Unset = UNSET
    deleted_at: str | Unset = UNSET
    directory: str | Unset = UNSET
    efast: TypesEfast | Unset = UNSET
    ein: str | Unset = UNSET
    employees: int | Unset = UNSET
    external: list[TypesExternalContact] | Unset = UNSET
    fields: list[TypesField] | Unset = UNSET
    fye: str | Unset = UNSET
    history: list[TypesClientSummary] | Unset = UNSET
    ignore_emails: bool | Unset = UNSET
    last_follow_up: str | Unset = UNSET
    locations: list[TypesLocation] | Unset = UNSET
    meetings: list[TypesMeeting] | Unset = UNSET
    messages: list[TypesMessage] | Unset = UNSET
    naics_code: str | Unset = UNSET
    name: str | Unset = UNSET
    notes: str | Unset = UNSET
    notices: list[TypesNoticeProgress] | Unset = UNSET
    payroll: TypesPayrollConfig | Unset = UNSET
    phone: str | Unset = UNSET
    plans: list[TypesRetirementPlan] | Unset = UNSET
    primary_id: str | Unset = UNSET
    primary_team: str | Unset = UNSET
    primary_team_name: str | Unset = UNSET
    projects: list[TypesProject] | Unset = UNSET
    pulse: TypesPulse | Unset = UNSET
    pulse_total: int | Unset = UNSET
    shared: str | Unset = UNSET
    shared_folders: list[TypesFile] | Unset = UNSET
    status: str | Unset = UNSET
    suggested_tasks: list[str] | Unset = UNSET
    summary: list[str] | Unset = UNSET
    summary_for_client: list[str] | Unset = UNSET
    summary_stale: bool | Unset = UNSET
    tags: list[str] | Unset = UNSET
    tasks: list[TypesTask] | Unset = UNSET
    team: str | Unset = UNSET
    total_value: float | Unset = UNSET
    view: str | Unset = UNSET
    website: str | Unset = UNSET
    won_value: float | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

    def to_dict(self) -> dict[str, Any]:
        field_id = self.field_id

        activity: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.activity, Unset):
            activity = []
            for activity_item_data in self.activity:
                activity_item = activity_item_data.to_dict()
                activity.append(activity_item)

        address: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.address, Unset):
            address = []
            for address_item_data in self.address:
                address_item = address_item_data.to_dict()
                address.append(address_item)

        allow_multiple_payrolls = self.allow_multiple_payrolls

        assignee_tasks: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.assignee_tasks, Unset):
            assignee_tasks = []
            for assignee_tasks_item_data in self.assignee_tasks:
                assignee_tasks_item = assignee_tasks_item_data.to_dict()
                assignee_tasks.append(assignee_tasks_item)

        assignees: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.assignees, Unset):
            assignees = []
            for assignees_item_data in self.assignees:
                assignees_item = assignees_item_data.to_dict()
                assignees.append(assignees_item)

        business_type = self.business_type

        census_status = self.census_status

        census_task = self.census_task

        comments: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.comments, Unset):
            comments = []
            for comments_item_data in self.comments:
                comments_item = comments_item_data.to_dict()
                comments.append(comments_item)

        contacts: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.contacts, Unset):
            contacts = []
            for contacts_item_data in self.contacts:
                contacts_item = contacts_item_data.to_dict()
                contacts.append(contacts_item)

        created_at = self.created_at

        deals: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.deals, Unset):
            deals = []
            for deals_item_data in self.deals:
                deals_item = deals_item_data.to_dict()
                deals.append(deals_item)

        deleted_at = self.deleted_at

        directory = self.directory

        efast: dict[str, Any] | Unset = UNSET
        if not isinstance(self.efast, Unset):
            efast = self.efast.to_dict()

        ein = self.ein

        employees = self.employees

        external: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.external, Unset):
            external = []
            for external_item_data in self.external:
                external_item = external_item_data.to_dict()
                external.append(external_item)

        fields: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.fields, Unset):
            fields = []
            for fields_item_data in self.fields:
                fields_item = fields_item_data.to_dict()
                fields.append(fields_item)

        fye = self.fye

        history: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.history, Unset):
            history = []
            for history_item_data in self.history:
                history_item = history_item_data.to_dict()
                history.append(history_item)

        ignore_emails = self.ignore_emails

        last_follow_up = self.last_follow_up

        locations: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.locations, Unset):
            locations = []
            for locations_item_data in self.locations:
                locations_item = locations_item_data.to_dict()
                locations.append(locations_item)

        meetings: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.meetings, Unset):
            meetings = []
            for meetings_item_data in self.meetings:
                meetings_item = meetings_item_data.to_dict()
                meetings.append(meetings_item)

        messages: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.messages, Unset):
            messages = []
            for messages_item_data in self.messages:
                messages_item = messages_item_data.to_dict()
                messages.append(messages_item)

        naics_code = self.naics_code

        name = self.name

        notes = self.notes

        notices: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.notices, Unset):
            notices = []
            for notices_item_data in self.notices:
                notices_item = notices_item_data.to_dict()
                notices.append(notices_item)

        payroll: dict[str, Any] | Unset = UNSET
        if not isinstance(self.payroll, Unset):
            payroll = self.payroll.to_dict()

        phone = self.phone

        plans: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.plans, Unset):
            plans = []
            for plans_item_data in self.plans:
                plans_item = plans_item_data.to_dict()
                plans.append(plans_item)

        primary_id = self.primary_id

        primary_team = self.primary_team

        primary_team_name = self.primary_team_name

        projects: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.projects, Unset):
            projects = []
            for projects_item_data in self.projects:
                projects_item = projects_item_data.to_dict()
                projects.append(projects_item)

        pulse: dict[str, Any] | Unset = UNSET
        if not isinstance(self.pulse, Unset):
            pulse = self.pulse.to_dict()

        pulse_total = self.pulse_total

        shared = self.shared

        shared_folders: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.shared_folders, Unset):
            shared_folders = []
            for shared_folders_item_data in self.shared_folders:
                shared_folders_item = shared_folders_item_data.to_dict()
                shared_folders.append(shared_folders_item)

        status = self.status

        suggested_tasks: list[str] | Unset = UNSET
        if not isinstance(self.suggested_tasks, Unset):
            suggested_tasks = self.suggested_tasks

        summary: list[str] | Unset = UNSET
        if not isinstance(self.summary, Unset):
            summary = self.summary

        summary_for_client: list[str] | Unset = UNSET
        if not isinstance(self.summary_for_client, Unset):
            summary_for_client = self.summary_for_client

        summary_stale = self.summary_stale

        tags: list[str] | Unset = UNSET
        if not isinstance(self.tags, Unset):
            tags = self.tags

        tasks: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.tasks, Unset):
            tasks = []
            for tasks_item_data in self.tasks:
                tasks_item = tasks_item_data.to_dict()
                tasks.append(tasks_item)

        team = self.team

        total_value = self.total_value

        view = self.view

        website = self.website

        won_value = self.won_value

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if field_id is not UNSET:
            field_dict["_id"] = field_id
        if activity is not UNSET:
            field_dict["activity"] = activity
        if address is not UNSET:
            field_dict["address"] = address
        if allow_multiple_payrolls is not UNSET:
            field_dict["allow_multiple_payrolls"] = allow_multiple_payrolls
        if assignee_tasks is not UNSET:
            field_dict["assignee_tasks"] = assignee_tasks
        if assignees is not UNSET:
            field_dict["assignees"] = assignees
        if business_type is not UNSET:
            field_dict["business_type"] = business_type
        if census_status is not UNSET:
            field_dict["census_status"] = census_status
        if census_task is not UNSET:
            field_dict["census_task"] = census_task
        if comments is not UNSET:
            field_dict["comments"] = comments
        if contacts is not UNSET:
            field_dict["contacts"] = contacts
        if created_at is not UNSET:
            field_dict["created_at"] = created_at
        if deals is not UNSET:
            field_dict["deals"] = deals
        if deleted_at is not UNSET:
            field_dict["deleted_at"] = deleted_at
        if directory is not UNSET:
            field_dict["directory"] = directory
        if efast is not UNSET:
            field_dict["efast"] = efast
        if ein is not UNSET:
            field_dict["ein"] = ein
        if employees is not UNSET:
            field_dict["employees"] = employees
        if external is not UNSET:
            field_dict["external"] = external
        if fields is not UNSET:
            field_dict["fields"] = fields
        if fye is not UNSET:
            field_dict["fye"] = fye
        if history is not UNSET:
            field_dict["history"] = history
        if ignore_emails is not UNSET:
            field_dict["ignore_emails"] = ignore_emails
        if last_follow_up is not UNSET:
            field_dict["last_follow_up"] = last_follow_up
        if locations is not UNSET:
            field_dict["locations"] = locations
        if meetings is not UNSET:
            field_dict["meetings"] = meetings
        if messages is not UNSET:
            field_dict["messages"] = messages
        if naics_code is not UNSET:
            field_dict["naics_code"] = naics_code
        if name is not UNSET:
            field_dict["name"] = name
        if notes is not UNSET:
            field_dict["notes"] = notes
        if notices is not UNSET:
            field_dict["notices"] = notices
        if payroll is not UNSET:
            field_dict["payroll"] = payroll
        if phone is not UNSET:
            field_dict["phone"] = phone
        if plans is not UNSET:
            field_dict["plans"] = plans
        if primary_id is not UNSET:
            field_dict["primary_id"] = primary_id
        if primary_team is not UNSET:
            field_dict["primary_team"] = primary_team
        if primary_team_name is not UNSET:
            field_dict["primary_team_name"] = primary_team_name
        if projects is not UNSET:
            field_dict["projects"] = projects
        if pulse is not UNSET:
            field_dict["pulse"] = pulse
        if pulse_total is not UNSET:
            field_dict["pulse_total"] = pulse_total
        if shared is not UNSET:
            field_dict["shared"] = shared
        if shared_folders is not UNSET:
            field_dict["shared_folders"] = shared_folders
        if status is not UNSET:
            field_dict["status"] = status
        if suggested_tasks is not UNSET:
            field_dict["suggested_tasks"] = suggested_tasks
        if summary is not UNSET:
            field_dict["summary"] = summary
        if summary_for_client is not UNSET:
            field_dict["summary_for_client"] = summary_for_client
        if summary_stale is not UNSET:
            field_dict["summary_stale"] = summary_stale
        if tags is not UNSET:
            field_dict["tags"] = tags
        if tasks is not UNSET:
            field_dict["tasks"] = tasks
        if team is not UNSET:
            field_dict["team"] = team
        if total_value is not UNSET:
            field_dict["total_value"] = total_value
        if view is not UNSET:
            field_dict["view"] = view
        if website is not UNSET:
            field_dict["website"] = website
        if won_value is not UNSET:
            field_dict["won_value"] = won_value

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        from ..models.types_activity import TypesActivity
        from ..models.types_address import TypesAddress
        from ..models.types_assignee import TypesAssignee
        from ..models.types_assignee_tasks import TypesAssigneeTasks
        from ..models.types_client_contact import TypesClientContact
        from ..models.types_client_summary import TypesClientSummary
        from ..models.types_comment import TypesComment
        from ..models.types_deal import TypesDeal
        from ..models.types_efast import TypesEfast
        from ..models.types_external_contact import TypesExternalContact
        from ..models.types_field import TypesField
        from ..models.types_file import TypesFile
        from ..models.types_location import TypesLocation
        from ..models.types_meeting import TypesMeeting
        from ..models.types_message import TypesMessage
        from ..models.types_notice_progress import TypesNoticeProgress
        from ..models.types_payroll_config import TypesPayrollConfig
        from ..models.types_project import TypesProject
        from ..models.types_pulse import TypesPulse
        from ..models.types_retirement_plan import TypesRetirementPlan
        from ..models.types_task import TypesTask

        d = dict(src_dict)
        field_id = d.pop("_id", UNSET)

        _activity = d.pop("activity", UNSET)
        activity: list[TypesActivity] | Unset = UNSET
        if _activity is not UNSET:
            activity = []
            for activity_item_data in _activity:
                activity_item = TypesActivity.from_dict(activity_item_data)

                activity.append(activity_item)

        _address = d.pop("address", UNSET)
        address: list[TypesAddress] | Unset = UNSET
        if _address is not UNSET:
            address = []
            for address_item_data in _address:
                address_item = TypesAddress.from_dict(address_item_data)

                address.append(address_item)

        allow_multiple_payrolls = d.pop("allow_multiple_payrolls", UNSET)

        _assignee_tasks = d.pop("assignee_tasks", UNSET)
        assignee_tasks: list[TypesAssigneeTasks] | Unset = UNSET
        if _assignee_tasks is not UNSET:
            assignee_tasks = []
            for assignee_tasks_item_data in _assignee_tasks:
                assignee_tasks_item = TypesAssigneeTasks.from_dict(assignee_tasks_item_data)

                assignee_tasks.append(assignee_tasks_item)

        _assignees = d.pop("assignees", UNSET)
        assignees: list[TypesAssignee] | Unset = UNSET
        if _assignees is not UNSET:
            assignees = []
            for assignees_item_data in _assignees:
                assignees_item = TypesAssignee.from_dict(assignees_item_data)

                assignees.append(assignees_item)

        business_type = d.pop("business_type", UNSET)

        census_status = d.pop("census_status", UNSET)

        census_task = d.pop("census_task", UNSET)

        _comments = d.pop("comments", UNSET)
        comments: list[TypesComment] | Unset = UNSET
        if _comments is not UNSET:
            comments = []
            for comments_item_data in _comments:
                comments_item = TypesComment.from_dict(comments_item_data)

                comments.append(comments_item)

        _contacts = d.pop("contacts", UNSET)
        contacts: list[TypesClientContact] | Unset = UNSET
        if _contacts is not UNSET:
            contacts = []
            for contacts_item_data in _contacts:
                contacts_item = TypesClientContact.from_dict(contacts_item_data)

                contacts.append(contacts_item)

        created_at = d.pop("created_at", UNSET)

        _deals = d.pop("deals", UNSET)
        deals: list[TypesDeal] | Unset = UNSET
        if _deals is not UNSET:
            deals = []
            for deals_item_data in _deals:
                deals_item = TypesDeal.from_dict(deals_item_data)

                deals.append(deals_item)

        deleted_at = d.pop("deleted_at", UNSET)

        directory = d.pop("directory", UNSET)

        _efast = d.pop("efast", UNSET)
        efast: TypesEfast | Unset
        if isinstance(_efast, Unset):
            efast = UNSET
        else:
            efast = TypesEfast.from_dict(_efast)

        ein = d.pop("ein", UNSET)

        employees = d.pop("employees", UNSET)

        _external = d.pop("external", UNSET)
        external: list[TypesExternalContact] | Unset = UNSET
        if _external is not UNSET:
            external = []
            for external_item_data in _external:
                external_item = TypesExternalContact.from_dict(external_item_data)

                external.append(external_item)

        _fields = d.pop("fields", UNSET)
        fields: list[TypesField] | Unset = UNSET
        if _fields is not UNSET:
            fields = []
            for fields_item_data in _fields:
                fields_item = TypesField.from_dict(fields_item_data)

                fields.append(fields_item)

        fye = d.pop("fye", UNSET)

        _history = d.pop("history", UNSET)
        history: list[TypesClientSummary] | Unset = UNSET
        if _history is not UNSET:
            history = []
            for history_item_data in _history:
                history_item = TypesClientSummary.from_dict(history_item_data)

                history.append(history_item)

        ignore_emails = d.pop("ignore_emails", UNSET)

        last_follow_up = d.pop("last_follow_up", UNSET)

        _locations = d.pop("locations", UNSET)
        locations: list[TypesLocation] | Unset = UNSET
        if _locations is not UNSET:
            locations = []
            for locations_item_data in _locations:
                locations_item = TypesLocation.from_dict(locations_item_data)

                locations.append(locations_item)

        _meetings = d.pop("meetings", UNSET)
        meetings: list[TypesMeeting] | Unset = UNSET
        if _meetings is not UNSET:
            meetings = []
            for meetings_item_data in _meetings:
                meetings_item = TypesMeeting.from_dict(meetings_item_data)

                meetings.append(meetings_item)

        _messages = d.pop("messages", UNSET)
        messages: list[TypesMessage] | Unset = UNSET
        if _messages is not UNSET:
            messages = []
            for messages_item_data in _messages:
                messages_item = TypesMessage.from_dict(messages_item_data)

                messages.append(messages_item)

        naics_code = d.pop("naics_code", UNSET)

        name = d.pop("name", UNSET)

        notes = d.pop("notes", UNSET)

        _notices = d.pop("notices", UNSET)
        notices: list[TypesNoticeProgress] | Unset = UNSET
        if _notices is not UNSET:
            notices = []
            for notices_item_data in _notices:
                notices_item = TypesNoticeProgress.from_dict(notices_item_data)

                notices.append(notices_item)

        _payroll = d.pop("payroll", UNSET)
        payroll: TypesPayrollConfig | Unset
        if isinstance(_payroll, Unset):
            payroll = UNSET
        else:
            payroll = TypesPayrollConfig.from_dict(_payroll)

        phone = d.pop("phone", UNSET)

        _plans = d.pop("plans", UNSET)
        plans: list[TypesRetirementPlan] | Unset = UNSET
        if _plans is not UNSET:
            plans = []
            for plans_item_data in _plans:
                plans_item = TypesRetirementPlan.from_dict(plans_item_data)

                plans.append(plans_item)

        primary_id = d.pop("primary_id", UNSET)

        primary_team = d.pop("primary_team", UNSET)

        primary_team_name = d.pop("primary_team_name", UNSET)

        _projects = d.pop("projects", UNSET)
        projects: list[TypesProject] | Unset = UNSET
        if _projects is not UNSET:
            projects = []
            for projects_item_data in _projects:
                projects_item = TypesProject.from_dict(projects_item_data)

                projects.append(projects_item)

        _pulse = d.pop("pulse", UNSET)
        pulse: TypesPulse | Unset
        if isinstance(_pulse, Unset):
            pulse = UNSET
        else:
            pulse = TypesPulse.from_dict(_pulse)

        pulse_total = d.pop("pulse_total", UNSET)

        shared = d.pop("shared", UNSET)

        _shared_folders = d.pop("shared_folders", UNSET)
        shared_folders: list[TypesFile] | Unset = UNSET
        if _shared_folders is not UNSET:
            shared_folders = []
            for shared_folders_item_data in _shared_folders:
                shared_folders_item = TypesFile.from_dict(shared_folders_item_data)

                shared_folders.append(shared_folders_item)

        status = d.pop("status", UNSET)

        suggested_tasks = cast(list[str], d.pop("suggested_tasks", UNSET))

        summary = cast(list[str], d.pop("summary", UNSET))

        summary_for_client = cast(list[str], d.pop("summary_for_client", UNSET))

        summary_stale = d.pop("summary_stale", UNSET)

        tags = cast(list[str], d.pop("tags", UNSET))

        _tasks = d.pop("tasks", UNSET)
        tasks: list[TypesTask] | Unset = UNSET
        if _tasks is not UNSET:
            tasks = []
            for tasks_item_data in _tasks:
                tasks_item = TypesTask.from_dict(tasks_item_data)

                tasks.append(tasks_item)

        team = d.pop("team", UNSET)

        total_value = d.pop("total_value", UNSET)

        view = d.pop("view", UNSET)

        website = d.pop("website", UNSET)

        won_value = d.pop("won_value", UNSET)

        types_client = cls(
            field_id=field_id,
            activity=activity,
            address=address,
            allow_multiple_payrolls=allow_multiple_payrolls,
            assignee_tasks=assignee_tasks,
            assignees=assignees,
            business_type=business_type,
            census_status=census_status,
            census_task=census_task,
            comments=comments,
            contacts=contacts,
            created_at=created_at,
            deals=deals,
            deleted_at=deleted_at,
            directory=directory,
            efast=efast,
            ein=ein,
            employees=employees,
            external=external,
            fields=fields,
            fye=fye,
            history=history,
            ignore_emails=ignore_emails,
            last_follow_up=last_follow_up,
            locations=locations,
            meetings=meetings,
            messages=messages,
            naics_code=naics_code,
            name=name,
            notes=notes,
            notices=notices,
            payroll=payroll,
            phone=phone,
            plans=plans,
            primary_id=primary_id,
            primary_team=primary_team,
            primary_team_name=primary_team_name,
            projects=projects,
            pulse=pulse,
            pulse_total=pulse_total,
            shared=shared,
            shared_folders=shared_folders,
            status=status,
            suggested_tasks=suggested_tasks,
            summary=summary,
            summary_for_client=summary_for_client,
            summary_stale=summary_stale,
            tags=tags,
            tasks=tasks,
            team=team,
            total_value=total_value,
            view=view,
            website=website,
            won_value=won_value,
        )

        types_client.additional_properties = d
        return types_client

    @property
    def additional_keys(self) -> list[str]:
        return list(self.additional_properties.keys())

    def __getitem__(self, key: str) -> Any:
        return self.additional_properties[key]

    def __setitem__(self, key: str, value: Any) -> None:
        self.additional_properties[key] = value

    def __delitem__(self, key: str) -> None:
        del self.additional_properties[key]

    def __contains__(self, key: str) -> bool:
        return key in self.additional_properties
