from __future__ import annotations

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

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

from ..types import UNSET, Unset

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


@_attrs_define
class TypesPayrollReportMapping:
    """
    Attributes:
        absolute (bool | Unset): The absolute flag is set to true if this is a *_block report type and the cell selected
            is above the first block (used for period end date)
        field (str | Unset): If the report type is a table, each field has a column index and the field name
            Field names: Period End Date, Full Name, First Name, Last Name, Full SSN, SSN Last 4, Phone, Email, Birth Date,
            Hire Date, Termination Date, Rehire Date, Group, Hours Worked, Gross Pay, Net Pay, EE Pre-tax, EE Roth, ER
            Match, ER Non-Elective, ER SH Match, ER SH Non-Elective, Loan Payment
            One of the name and SSN options are required
            Users can also add custom field names to be used in equations
        format_ (str | Unset): Format
        post_proc_example_output (str | Unset):
        post_proc_example_raw (str | Unset):
        ref_direction_horizontal (bool | Unset):
        ref_distance (int | Unset):
        ref_from_end (bool | Unset): Reference direction rule - from start/end and number of cells away from the
            appropriate edge
        ref_is_absolute (bool | Unset): If we use a reference label, we need to mark the direction, distance, and the
            absolute row/col
        ref_label (str | Unset): eg "Fringe Ben Life Ins*"
        ref_static_index (int | Unset): Use a static index to fix the row/col perpendicular to the reference label
            direction - relative if the direction is opposite to the report_type direction
        section_column_index (int | Unset): Section for Row Blocks
        section_text (str | Unset):
    """

    absolute: bool | Unset = UNSET
    field: str | Unset = UNSET
    format_: str | Unset = UNSET
    post_proc_example_output: str | Unset = UNSET
    post_proc_example_raw: str | Unset = UNSET
    ref_direction_horizontal: bool | Unset = UNSET
    ref_distance: int | Unset = UNSET
    ref_from_end: bool | Unset = UNSET
    ref_is_absolute: bool | Unset = UNSET
    ref_label: str | Unset = UNSET
    ref_static_index: int | Unset = UNSET
    section_column_index: int | Unset = UNSET
    section_text: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        field = self.field

        format_ = self.format_

        post_proc_example_output = self.post_proc_example_output

        post_proc_example_raw = self.post_proc_example_raw

        ref_direction_horizontal = self.ref_direction_horizontal

        ref_distance = self.ref_distance

        ref_from_end = self.ref_from_end

        ref_is_absolute = self.ref_is_absolute

        ref_label = self.ref_label

        ref_static_index = self.ref_static_index

        section_column_index = self.section_column_index

        section_text = self.section_text

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if absolute is not UNSET:
            field_dict["absolute"] = absolute
        if field is not UNSET:
            field_dict["field"] = field
        if format_ is not UNSET:
            field_dict["format"] = format_
        if post_proc_example_output is not UNSET:
            field_dict["post_proc_example_output"] = post_proc_example_output
        if post_proc_example_raw is not UNSET:
            field_dict["post_proc_example_raw"] = post_proc_example_raw
        if ref_direction_horizontal is not UNSET:
            field_dict["ref_direction_horizontal"] = ref_direction_horizontal
        if ref_distance is not UNSET:
            field_dict["ref_distance"] = ref_distance
        if ref_from_end is not UNSET:
            field_dict["ref_from_end"] = ref_from_end
        if ref_is_absolute is not UNSET:
            field_dict["ref_is_absolute"] = ref_is_absolute
        if ref_label is not UNSET:
            field_dict["ref_label"] = ref_label
        if ref_static_index is not UNSET:
            field_dict["ref_static_index"] = ref_static_index
        if section_column_index is not UNSET:
            field_dict["section_column_index"] = section_column_index
        if section_text is not UNSET:
            field_dict["section_text"] = section_text

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        d = dict(src_dict)
        absolute = d.pop("absolute", UNSET)

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

        format_ = d.pop("format", UNSET)

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

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

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

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

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

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

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

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

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

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

        types_payroll_report_mapping = cls(
            absolute=absolute,
            field=field,
            format_=format_,
            post_proc_example_output=post_proc_example_output,
            post_proc_example_raw=post_proc_example_raw,
            ref_direction_horizontal=ref_direction_horizontal,
            ref_distance=ref_distance,
            ref_from_end=ref_from_end,
            ref_is_absolute=ref_is_absolute,
            ref_label=ref_label,
            ref_static_index=ref_static_index,
            section_column_index=section_column_index,
            section_text=section_text,
        )

        types_payroll_report_mapping.additional_properties = d
        return types_payroll_report_mapping

    @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
