2024-01-01 11:40:21 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Values;
|
|
|
|
|
2024-05-31 05:40:34 +00:00
|
|
|
use App\Models\Song as Playable;
|
2024-01-01 11:40:21 +00:00
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
|
2024-01-04 21:51:32 +00:00
|
|
|
final class QueueState
|
2024-01-01 11:40:21 +00:00
|
|
|
{
|
2024-05-31 05:40:34 +00:00
|
|
|
private function __construct(
|
|
|
|
public Collection $playables,
|
|
|
|
public ?Playable $currentPlayable,
|
|
|
|
public ?int $playbackPosition
|
|
|
|
) {
|
2024-01-01 11:40:21 +00:00
|
|
|
}
|
|
|
|
|
2024-05-31 05:40:34 +00:00
|
|
|
public static function make(Collection $songs, ?Playable $currentPlayable = null, ?int $playbackPosition = 0): self
|
2024-01-01 11:40:21 +00:00
|
|
|
{
|
2024-05-31 05:40:34 +00:00
|
|
|
return new self($songs, $currentPlayable, $playbackPosition);
|
2024-01-01 11:40:21 +00:00
|
|
|
}
|
|
|
|
}
|