import type { FilterPresetId, ImageAdjustments } from "@/lib/image-editor-types";
import { DEFAULT_ADJUSTMENTS } from "@/lib/image-editor-types";

export interface FilterPreset {
  id: FilterPresetId;
  label: string;
  adjustments: ImageAdjustments;
}

export const FILTER_PRESETS: FilterPreset[] = [
  { id: "original", label: "Original", adjustments: { ...DEFAULT_ADJUSTMENTS } },
  {
    id: "vivid",
    label: "Vivid",
    adjustments: { ...DEFAULT_ADJUSTMENTS, contrast: 28, saturation: 45 },
  },
  {
    id: "warm",
    label: "Warm",
    adjustments: { ...DEFAULT_ADJUSTMENTS, hue: 18, saturation: 22, brightness: 6 },
  },
  {
    id: "cool",
    label: "Cool",
    adjustments: { ...DEFAULT_ADJUSTMENTS, hue: -22, saturation: 12, brightness: 4 },
  },
  {
    id: "bw",
    label: "Black & White",
    adjustments: { ...DEFAULT_ADJUSTMENTS, saturation: -100, contrast: 12 },
  },
  {
    id: "vintage",
    label: "Vintage",
    adjustments: {
      ...DEFAULT_ADJUSTMENTS,
      contrast: -12,
      saturation: -35,
      brightness: 12,
      vignette: 35,
    },
  },
  {
    id: "fade",
    label: "Fade",
    adjustments: {
      ...DEFAULT_ADJUSTMENTS,
      contrast: -18,
      brightness: 18,
      saturation: -25,
    },
  },
  {
    id: "chrome",
    label: "Chrome",
    adjustments: {
      ...DEFAULT_ADJUSTMENTS,
      contrast: 38,
      saturation: 28,
      sharpen: 4,
    },
  },
  {
    id: "moody",
    label: "Moody",
    adjustments: {
      ...DEFAULT_ADJUSTMENTS,
      brightness: -18,
      contrast: 22,
      saturation: -28,
      vignette: 45,
    },
  },
  {
    id: "sunset",
    label: "Sunset",
    adjustments: {
      ...DEFAULT_ADJUSTMENTS,
      hue: 24,
      saturation: 38,
      brightness: 8,
    },
  },
  {
    id: "forest",
    label: "Forest",
    adjustments: {
      ...DEFAULT_ADJUSTMENTS,
      hue: -28,
      saturation: 24,
      contrast: 10,
    },
  },
  {
    id: "dramatic",
    label: "Dramatic",
    adjustments: {
      ...DEFAULT_ADJUSTMENTS,
      contrast: 42,
      brightness: -12,
      saturation: 18,
      vignette: 55,
      sharpen: 2,
    },
  },
];

export function getPresetById(id: FilterPresetId): FilterPreset {
  return FILTER_PRESETS.find((preset) => preset.id === id) ?? FILTER_PRESETS[0];
}
