# This file was auto-generated by Fern from our API Definition.

import typing

from ..core import enum

T_Result = typing.TypeVar("T_Result")


class XgBoostSerializationFormat(enum.StrEnum):
    """
    Serialization format used to save the xgboost model
    """

    CLOUDPICKLE = "cloudpickle"
    JOBLIB = "joblib"
    PICKLE = "pickle"
    JSON = "json"

    def visit(
        self,
        cloudpickle: typing.Callable[[], T_Result],
        joblib: typing.Callable[[], T_Result],
        pickle: typing.Callable[[], T_Result],
        json: typing.Callable[[], T_Result],
    ) -> T_Result:
        if self is XgBoostSerializationFormat.CLOUDPICKLE:
            return cloudpickle()
        if self is XgBoostSerializationFormat.JOBLIB:
            return joblib()
        if self is XgBoostSerializationFormat.PICKLE:
            return pickle()
        if self is XgBoostSerializationFormat.JSON:
            return json()
