/**
 * Modular FFmpeg filter fragments for the Songs2VID brand watermark overlay.
 * Honors corner/center position + padding; scales to a fraction of frame width.
 */
import { overlayXy, type WatermarkPosition } from "../watermark";

export function buildBrandWatermarkOverlayFilters(options: {
  baseLabel: string;
  watermarkInputIndex: number;
  watermarkWidthPx: number;
  position?: WatermarkPosition;
  offsetX?: number;
  offsetY?: number;
  outLabel?: string;
}): string[] {
  const ox = options.offsetX ?? 20;
  const oy = options.offsetY ?? 20;
  const position = options.position ?? "bottom-right";
  const { x, y } = overlayXy(position, ox, oy);
  const out = options.outLabel ?? "vout";
  return [
    `[${options.watermarkInputIndex}:v]scale=${options.watermarkWidthPx}:-1[wm]`,
    `[${options.baseLabel}][wm]overlay=${x}:${y}[${out}]`,
  ];
}
