<?php

namespace Shm\ShmChat\Classes;

class FindChannelsInput
{
    /** @var list<ChatMember> */
    public array $members = [];

    /** @var list<ChannelReference> */
    public array $references = [];

    public ?string $type = null;
    public ?string $space = null;
    public ?bool $closed = null;

    public function withMember(ChatMember $member): self
    {
        $this->members[] = $member;

        return $this;
    }

    public function withReference(ChannelReference $ref): self
    {
        $this->references[] = $ref;

        return $this;
    }

    public static function byReference(ChannelReference $ref): self
    {
        $input = new self();
        $input->references = [$ref];

        return $input;
    }

    public static function byMembers(ChatMember ...$members): self
    {
        $input = new self();
        $input->members = array_values($members);

        return $input;
    }
}
