<?php

namespace App\Support\Bulk;

final class BulkOperationResult
{
    /**
     * @param  list<int|string>  $succeeded
     * @param  list<array{id: int|string, message: string}>  $failures
     */
    public function __construct(
        public readonly array $succeeded,
        public readonly array $failures,
        public readonly string $operationLabel,
    ) {}

    /**
     * @return array{succeeded: list<int|string>, failures: list<array{id: int|string, message: string}>, label: string}
     */
    public function toSessionPayload(): array
    {
        return [
            'succeeded' => $this->succeeded,
            'failures' => $this->failures,
            'label' => $this->operationLabel,
        ];
    }
}
