<?php

namespace MintyPHP\Service\Import\Profile;

interface ImportProfileInterface
{
    public function key(): string;

    public function label(): string;

    /**
     * @return array<string, string> target => label
     */
    public function allowedTargets(): array;

    /**
     * @return array<int, string>
     */
    public function requiredTargets(): array;

    /**
     * @return array<string, array<int, string>> target => aliases
     */
    public function autoMapAliases(): array;

    public function supportsAssignments(): bool;

    public function requiresAssignmentPermission(): bool;

    /**
     * @param array<string, string> $mapped
     * @param array<string, mixed> $context
     * @return array{ok:bool, normalized:array<string,mixed>, errors:array<int,array{code:string,message?:string}>}
     */
    public function validateMappedRow(array $mapped, array $context): array;

    /**
     * @param array<string, mixed> $normalized
     * @param array<string, mixed> $context
     * @return array{status:string, code?:string, message?:string}
     */
    public function dryRunRow(array $normalized, array $context): array;

    /**
     * @param array<string, mixed> $normalized
     * @param array<string, mixed> $context
     * @return array{status:string, code?:string, message?:string, uuid?:string}
     */
    public function commitRow(array $normalized, array $context): array;

    /**
     * Returns a deterministic key for in-file duplicate detection.
     * Return null when duplicate detection is not required for this row.
     *
     * @param array<string, mixed> $normalized
     */
    public function inFileDuplicateKey(array $normalized): ?string;

    /**
     * @param array<string, mixed> $normalized
     */
    public function rowIdentifier(array $normalized): string;
}
