<?php

namespace Fotogenic_AI;

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

/**
 * Product media write adapter — set featured image or add to gallery, no WC types.
 */
interface ProductMediaWriteAdapter {
	/**
	 * Apply one exact-target media mutation in a single product save.
	 *
	 * @param array $target         Server-owned exact target snapshot.
	 * @param int[] $attachment_ids Ordered attachment IDs.
	 * @param bool  $set_featured   Set the first attachment as featured.
	 * @param bool  $add_gallery    Add all attachments to the gallery.
	 * @return array{changed:bool}|\WP_Error
	 */
	public function apply_to_target( array $target, array $attachment_ids, bool $set_featured, bool $add_gallery );

	/**
	 * Remove one attachment from every exact Product or variation target.
	 * Implementations must resolve every target before mutating any target.
	 *
	 * @param array[] $targets       Server-resolved exact target snapshots.
	 * @param int     $attachment_id Attachment ID to remove.
	 * @return array{changed:bool}|\WP_Error
	 */
	public function remove_attachment_from_targets( array $targets, int $attachment_id );

}
