defmodule Berrypod.Theme.PresetsTest do
  use ExUnit.Case, async: true

  alias Berrypod.Theme.Presets

  describe "all/0" do
    test "returns all 8 presets" do
      presets = Presets.all()

      assert is_map(presets)
      assert map_size(presets) == 8
      assert Map.has_key?(presets, :gallery)
      assert Map.has_key?(presets, :studio)
      assert Map.has_key?(presets, :boutique)
      assert Map.has_key?(presets, :bold)
      assert Map.has_key?(presets, :playful)
      assert Map.has_key?(presets, :minimal)
      assert Map.has_key?(presets, :night)
      assert Map.has_key?(presets, :classic)
    end
  end

  describe "get/1" do
    test "returns gallery preset with correct settings" do
      preset = Presets.get(:gallery)

      assert preset.mood == "warm"
      assert preset.typography == "editorial"
      assert preset.shape == "soft"
      assert preset.density == "spacious"
      assert preset.grid_columns == "3"
      assert preset.header_layout == "centered"
      assert preset.accent_color == "#e85d04"
    end

    test "returns studio preset with correct settings" do
      preset = Presets.get(:studio)

      assert preset.mood == "neutral"
      assert preset.typography == "clean"
      assert preset.shape == "soft"
      assert preset.density == "balanced"
      assert preset.grid_columns == "4"
      assert preset.header_layout == "standard"
      assert preset.accent_color == "#2563eb"
    end

    test "returns boutique preset" do
      preset = Presets.get(:boutique)

      assert preset.mood == "warm"
      assert preset.typography == "classic"
      assert preset.accent_color == "#b45309"
    end

    test "returns bold preset" do
      preset = Presets.get(:bold)

      assert preset.mood == "neutral"
      assert preset.typography == "modern"
      assert preset.shape == "sharp"
      assert preset.accent_color == "#dc2626"
    end

    test "returns playful preset" do
      preset = Presets.get(:playful)

      assert preset.typography == "friendly"
      assert preset.shape == "pill"
      assert preset.accent_color == "#8b5cf6"
    end

    test "returns minimal preset" do
      preset = Presets.get(:minimal)

      assert preset.mood == "neutral"
      assert preset.typography == "impulse"
      assert preset.shape == "sharp"
      assert preset.accent_color == "#171717"
    end

    test "returns night preset" do
      preset = Presets.get(:night)

      assert preset.mood == "dark"
      assert preset.typography == "modern"
      assert preset.accent_color == "#f97316"
    end

    test "returns classic preset" do
      preset = Presets.get(:classic)

      assert preset.mood == "warm"
      assert preset.typography == "classic"
      assert preset.accent_color == "#166534"
    end

    test "returns nil for nonexistent preset" do
      assert Presets.get(:nonexistent) == nil
    end
  end

  describe "list_names/0" do
    test "returns list of all preset names" do
      names = Presets.list_names()

      assert is_list(names)
      assert length(names) == 8
      assert :gallery in names
      assert :studio in names
      assert :boutique in names
      assert :bold in names
      assert :playful in names
      assert :minimal in names
      assert :night in names
      assert :classic in names
    end
  end
end
