from __future__ import annotations

from rapidata.rapidata_client.filter._base_filter import RapidataFilter
from pydantic import BaseModel


class CustomFilter(RapidataFilter, BaseModel):
    """CustomFilter Class

    Can be used to filter who to target based on custom filters.

    Ought to be used with contact to Rapidata.

    Warning: If identifier does not exist, order will not get any responses.

    Args:
        identifier (str): Identifier of the custom filter.
        values (list[str]): List of values to filter by.
    """

    identifier: str
    values: list[str]

    def __init__(self, identifier: str, values: list[str]):
        super().__init__(identifier=identifier, values=values)

    def _to_model(self):
        from rapidata.api_client.models.i_user_filter_model import IUserFilterModel
        from rapidata.api_client.models.i_user_filter_model_custom_user_filter_model import (
            IUserFilterModelCustomUserFilterModel,
        )

        return IUserFilterModel(
            actual_instance=IUserFilterModelCustomUserFilterModel(
                _t="CustomFilter",
                identifier=self.identifier,
                values=self.values,
            )
        )
