<?php

namespace App\Media\QuickTime\Atoms\moov\trak\mdia;

use Leenooks\Traits\ObjectIssetFix;

use App\Media\QuickTime\Atoms\SubAtom;
use App\Media\QuickTime\Atoms\Unknown;

class minf extends SubAtom
{
	use ObjectIssetFix;

	private const subatom_classes = 'App\\Media\\QuickTime\\Atoms\\moov\\trak\\mdia\\minf\\';

	protected ?string $type;
	public function __construct(int $offset,int $size,string $filename,?string $data,string $arg=NULL)
	{
		parent::__construct($offset,$size,$filename);
		$this->type = $arg;

		$this->atoms = $this->get_atoms(self::subatom_classes,Unknown::class,$offset,$size,$data,$arg);

		// For debugging
		if (FALSE)
			$this->debug = hex_dump($data ?: $this->data());
	}

	public function __get(string $key): mixed
	{
		switch ($key) {
			case 'type':
				return $this->{$key};

			default:
				return parent::__get($key);
		}
	}
}