<?php
namespace App\HttpModels;

use App\Models\Lobby;

class LobbyModel {
    public $uid;
    public $name;
    public $isStrangerAccessible;
    public $isClientAccessible;
    public $meetings = [];

    public function __construct(Lobby $lobby)
    {
        $this->uid = $lobby->uid;
        $this->name = $lobby->name;
        $this->isStrangerAccessible = $lobby->is_stranger_accessible;
        $this->isClientAccessible = $lobby->is_client_accessible;
        foreach ($lobby->meetings()->where('meeting.is_active',true)->get() as $meeting) {
            $this->meetings[] = new MeetingModel($meeting);
        }
    }
}