from typing import Iterable, Union

from attrs import field, define
from attrs.validators import instance_of, deep_iterable

from src.data_classes.parameters_general import GeneralParameters


@define
class InfluenceOfVotesParameters(GeneralParameters):
    weight_as_distribution_quantile: bool = field(validator=instance_of(bool))
    weight_m: Union[int, float] = field(validator=instance_of((int, float)))
    model_name: str = field(validator=instance_of(str))
    step: list[int] = field(
        validator=deep_iterable(
            member_validator=instance_of(int), iterable_validator=instance_of(Iterable)
        ),
    )
    startpoint: Union[str, list[Union[int, float]]] = field(
        validator=instance_of((str, list))
    )
