<?php

namespace Lucent\Edge;

use Illuminate\Support\Collection;

/**
 * @extends \Illuminate\Support\Collection<int|string, Edge>
 */
final class EdgeCollection extends Collection
{

    public function __construct(
        Edge ...$array
    ) {
        parent::__construct($array);
    }

    /**
     * @return Edge[]
     **/
    public function toArray(): array
    {
        return collect($this)->values()->toArray();
    }

    public static function fromArray(array $data): EdgeCollection
    {
        $edges = array_map([Edge::class, 'fromArray'], $data);
        return new EdgeCollection(...$edges);
    }

  
}
