# This file is auto-generated by oagen. Do not edit.

from __future__ import annotations

from dataclasses import dataclass
from typing import Any, Dict, Optional
from workos._types import _raise_deserialize_error


@dataclass(slots=True)
class UserConsentOptionChoice:
    """User Consent Option Choice model."""

    value: Optional[str] = None
    """The value of this choice."""
    label: Optional[str] = None
    """A human-readable label for this choice."""

    @classmethod
    def from_dict(cls, data: Dict[str, Any]) -> "UserConsentOptionChoice":
        """Deserialize from a dictionary."""
        try:
            return cls(
                value=data.get("value"),
                label=data.get("label"),
            )
        except (KeyError, ValueError) as e:
            _raise_deserialize_error("UserConsentOptionChoice", e)

    def to_dict(self) -> Dict[str, Any]:
        """Serialize to a dictionary."""
        result: Dict[str, Any] = {}
        if self.value is not None:
            result["value"] = self.value
        if self.label is not None:
            result["label"] = self.label
        return result
