<?php

namespace App\Entity\Campaign\LandingPage;

use App\Entity\Campaign\LandingPage;
use App\Entity\Traits\TimestampableTrait;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity()
 * @ORM\Table(name="campaign_landing_page_backlinks")
 */
class BacklinksReport
{
    use TimestampableTrait;

    /**
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\ManyToOne(targetEntity="App\Entity\Campaign\LandingPage", inversedBy="backlinksReports")
     * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
     */
    private $landingPage;

    /**
     * @ORM\Column(type="text")
     */
    private $description;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getLandingPage(): ?LandingPage
    {
        return $this->landingPage;
    }

    public function setLandingPage(?LandingPage $landingPage): self
    {
        $this->landingPage = $landingPage;
        $landingPage->setLatestBacklinksReport($this);

        return $this;
    }

    public function getDescription(): ?array
    {
        return json_decode($this->description, true);
    }

    public function setDescription(string $description): self
    {
        $this->description = $description;

        return $this;
    }
}
