<?php

namespace Acms\Services\StaticExport;

class Destination
{
    /**
     * @var string
     */
    protected $destinationDocumentRoot;

    /**
     * @var string
     */
    protected $destinationOffsetDir;

    /**
     * @var string
     */
    protected $destinationDomain;

    /**
     * @var string
     */
    protected $blogCode;

    /**
     * @return string
     */
    public function getDestinationDomain()
    {
        return $this->destinationDomain;
    }

    /**
     * @param string $destinationDomain
     */
    public function setDestinationDomain($destinationDomain)
    {
        $this->destinationDomain = $destinationDomain;
    }

    /**
     * @return string
     */
    public function getDestinationPath()
    {
        return $this->getDestinationDocumentRoot() . $this->getDestinationOffsetDir();
    }

    /**
     * @return string
     */
    public function getDestinationDocumentRoot()
    {
        return $this->destinationDocumentRoot;
    }

    /**
     * @param string $destinationDocumentRoot
     */
    public function setDestinationDocumentRoot($destinationDocumentRoot)
    {
        $this->destinationDocumentRoot = rtrim($destinationDocumentRoot, '/') . '/';
    }

    /**
     * @return string
     */
    public function getDestinationOffsetDir()
    {
        return $this->destinationOffsetDir;
    }

    /**
     * @param string $destinationOffsetDir
     */
    public function setDestinationOffsetDir($destinationOffsetDir)
    {
        $this->destinationOffsetDir = trim($destinationOffsetDir, '/') . '/';
        if ( $this->destinationOffsetDir === '/' ) {
            $this->destinationOffsetDir = '';
        }
    }

    /**
     * @return string
     */
    public function getBlogCode()
    {
        return $this->blogCode;
    }

    /**
     * @param string $code
     */
    public function setBlogCode($code)
    {
        $this->blogCode = trim($code, '/') . '/';
        if ( $this->blogCode === '/' ) {
            $this->blogCode = '';
        }
    }
}