<?php

namespace Shm\ShmTypes\CompositeTypes;

use Shm\Shm;
use Shm\ShmTypes\StructureType;

class HallType extends StructureType
{
    public string $type = 'hall';


    public bool $compositeType = true;



    public static function HallBeltType()
    {
        return Shm::structure([
            'id' =>  Shm::nonNull(Shm::string()),
            'name' => Shm::nonNull(Shm::string()),
            'color' => Shm::nonNull(Shm::string()),
        ])->staticBaseTypeName("HallBelt");
    }

    public static function HallSeatType()
    {
        return Shm::structure([
            'id' => Shm::nonNull(Shm::string()),
            'x' =>  Shm::nonNull(Shm::float()),
            'y' =>  Shm::nonNull(Shm::float()),
            'seatNumber' => Shm::string(),
            'seatRow' => Shm::string(),
            'beltId' => Shm::string(),
            'sectorId' => Shm::string(),
            'radius' => Shm::float(),
            'sectorName' => Shm::string(),
            'rotation' =>  Shm::float(),

        ])->staticBaseTypeName("HallSeat");
    }

    public static function HallZoneType()
    {

        return  Shm::structure([
            'id' => Shm::nonNull(Shm::string()),
            'x' =>  Shm::nonNull(Shm::float()),
            'y' =>  Shm::nonNull(Shm::float()),
            'width' =>  Shm::nonNull(Shm::float()),
            'height' =>  Shm::nonNull(Shm::float()),
            'rotation' =>  Shm::float(),
            'capacity' => Shm::int(),
            'label' => Shm::string(),
        ])->staticBaseTypeName("HallZone");
    }

    public static function HallSectorType()
    {

        return Shm::structure([
            'id' => Shm::nonNull(Shm::string()),
            'x' =>  Shm::nonNull(Shm::float()),
            'y' =>  Shm::nonNull(Shm::float()),
            'width' =>  Shm::nonNull(Shm::float()),
            'height' =>  Shm::nonNull(Shm::float()),
            'rotation' =>  Shm::float(),
            'label' => Shm::string(),
        ])->staticBaseTypeName("HallSector");
    }

    public function __construct()
    {



        parent::__construct([

            'version' => Shm::int(),
            'belts' => Shm::arrayOf(HallType::HallBeltType()),

            'seats' => Shm::arrayOf(HallType::HallSeatType()),
            'tables' => Shm::arrayOf(Shm::structure([
                'id' => Shm::nonNull(Shm::string()),
                'x' =>  Shm::nonNull(Shm::float()),
                'y' =>  Shm::nonNull(Shm::float()),
                'width' =>  Shm::nonNull(Shm::float()),
                'height' =>  Shm::nonNull(Shm::float()),
                'rotation' =>  Shm::float(),
            ])->staticBaseTypeName("HallTable")),

            'stages' => Shm::arrayOf(Shm::structure([
                'id' => Shm::nonNull(Shm::string()),
                'x' =>  Shm::nonNull(Shm::float()),
                'y' =>  Shm::nonNull(Shm::float()),
                'width' =>  Shm::nonNull(Shm::float()),
                'height' =>  Shm::nonNull(Shm::float()),
                'label' => Shm::nonNull(Shm::string()),
                'rotation' =>  Shm::float(),
            ])->staticBaseTypeName("HallStage")),


            'walls' => Shm::arrayOf(Shm::structure([
                'id' => Shm::nonNull(Shm::string()),
                'x' =>  Shm::nonNull(Shm::float()),
                'y' =>  Shm::nonNull(Shm::float()),
                'width' =>  Shm::nonNull(Shm::float()),
                'height' =>  Shm::nonNull(Shm::float()),
                'rotation' =>  Shm::float(),
            ])->staticBaseTypeName("HallWall")),

            'zones' => Shm::arrayOf(self::HallZoneType()),

            'sectors' => Shm::arrayOf(self::HallSectorType()),


        ]);
        $this->staticBaseTypeName("Hall");
    }
}