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