# 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 FeatureFlagOwner:
    """Feature Flag Owner model."""

    email: str
    """The email address of the flag owner."""
    first_name: Optional[str]
    """The first name of the flag owner."""
    last_name: Optional[str]
    """The last name of the flag owner."""

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

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