<?php

namespace App\Collection;

use App\Entity\TaskSchema;

/**
 * @implements \IteratorAggregate<int, TaskSchema>
 */
final class TaskSchemaCollection implements \IteratorAggregate
{
    /** @var list<TaskSchema> */
    private array $schemas = [];

    /**
     * @param list<TaskSchema> $schemas
     */
    public function __construct(array $schemas = [])
    {
        foreach ($schemas as $schema) {
            $this->schemas[] = $schema;
        }
    }

    public function getIterator(): \Iterator
    {
        return new \ArrayIterator($this->schemas);
    }
}
