<?php

declare(strict_types=1);

namespace KupShop\GraphQLBundle\ApiPublic\Types\Content;

use TheCodingMachine\GraphQLite\Annotations\Field;
use TheCodingMachine\GraphQLite\Annotations\Type;

/**
 * @Type()
 */
class ContentBlock
{
    private array $block;

    public function __construct(array $block)
    {
        $this->block = $block;
    }

    /**
     * Id bloku.
     *
     * @Field()
     */
    public function getId(): int
    {
        return (int) $this->block['id'];
    }

    /**
     *  Html z kterého je složen obsah.
     *
     * @Field()
     */
    public function getHtml(): string
    {
        return (string) $this->block['content'];
    }

    /**
     * Název bloku.
     *
     * @Field()
     */
    public function getName(): string
    {
        return (string) $this->block['name'];
    }

    /**
     * JSON s daty pro vytvoření obsahu.
     *
     * @Field()
     */
    public function getData(): string
    {
        return (string) $this->block['json_content'];
    }
}
