<?php

class Zbr_News_Article
{

    protected string $title;
    protected string $content;
    protected array $media;
    protected array $attachments;
    protected string $sub_title;

    public function __construct()
    {

    }

    public static function from_post($post): Zbr_News_Article
    {
        $article = new Zbr_News_Article();
        $article->title = $post->post_title;
        $article->content = $post->post_content;
        $article->sub_title = get_post_meta($post->ID, '_zbr_sub_title', true);

        $article->media = get_post_meta($post->ID,'_zbr_media', true);
        $article->attachments = get_post_meta($post->ID, '_zbr_attachments', true);

        return $article;
    }

    public function get_title(): string
    {
        return $this->title;
    }

    public function get_media() : array {
        return $this->media;
    }

    public function get_sub_title(): string {
        return $this->sub_title;
    }
}