"""Recipe commands."""

from __future__ import annotations

from dataclasses import dataclass, field
from typing import List, Optional


@dataclass
class RecipeItemCommand:
    item_type: str
    item_id: str
    position: int = 0
    metadata_: dict = field(default_factory=dict)


@dataclass
class CreateRecipeCommand:
    user_id: str
    name: str
    description: str = ""
    template_id: str = ""
    generation_params: dict = field(default_factory=dict)
    items: List[RecipeItemCommand] = field(default_factory=list)
    metadata_: dict = field(default_factory=dict)


@dataclass
class UpdateRecipeCommand:
    recipe_id: str
    user_id: str
    name: Optional[str] = None
    description: Optional[str] = None
    template_id: Optional[str] = None
    generation_params: Optional[dict] = None
    items: Optional[List[RecipeItemCommand]] = None
    metadata_: Optional[dict] = None
