from typing import Union, Optional

from attrs import field, define
from attrs.validators import instance_of, deep_iterable, optional
from src.data_classes.parameters_visualization import PlotParameters


@define
class ForestPlotPairedTTestParameters(PlotParameters):
    paired_ttest_names: list[str] = field(
        validator=deep_iterable(
            member_validator=instance_of(str), iterable_validator=instance_of(list)
        )
    )
    paired_ttest_labels: list[str] = field(
        validator=[
            deep_iterable(
                member_validator=instance_of(str),
                iterable_validator=instance_of(list),
            ),
        ],
    )
    x_axis_minimum: Optional[Union[int, float]] = field(
        default=None, validator=optional(instance_of((int, float)))
    )
    x_axis_maximum: Optional[Union[int, float]] = field(
        default=None, validator=optional(instance_of((int, float)))
    )
    dotsize: Optional[int] = field(default=5, validator=optional(instance_of(int)))
    dataset: str = "data"
