<?php
namespace nur\v\html5;

use nur\md;
use nur\v\base\AbstractLayoutManager;
use nur\v\v;

class Html5LayoutManager extends AbstractLayoutManager {
  const ROW_OPTIONS_SCHEMA = [
    "class" => "?string",
  ];

  protected function getRowTags($options): array {
    md::ensure_schema($options, self::ROW_OPTIONS_SCHEMA);
    return [
      v::sdiv(["class" => ["row", $options["class"]]]),
      v::ediv(),
    ];
  }

  const COL_OPTIONS_SCHEMA = [
    "class" => "?string",
  ];

  protected function getColTags($size, $options): array {
    md::ensure_schema($options, self::COL_OPTIONS_SCHEMA);
    return [
      v::sdiv(["class" => ["col", $options["class"]]]),
      v::ediv(),
    ];
  }

  const PANEL_OPTIONS_SCHEMA = [
    "class" => "?string",
  ];

  protected function getPanelTags($title, $options): array {
    md::ensure_schema($options, self::PANEL_OPTIONS_SCHEMA);
    return [
      v::sdiv([
        "class" => ["panel", $options["class"]],
        v::h2($title),
      ]),
      v::ediv(),
    ];
  }
}