<?php
// Copyright 1999-2017. Plesk International GmbH. All rights reserved.

namespace Plesk\MigrationLibV8\Common;

class SessionFiles
{
    protected SessionDirectory $_session;

    public function __construct(SessionDirectory $session)
    {
        $this->_session = $session;
    }

    /**
     * @return string
     */
    public function getConfigPath()
    {
        return $this->_session->getPath() . DIRECTORY_SEPARATOR . 'config.ini';
    }

    /**
     * @return string
     */
    public function getSubscriptionsStatusPath()
    {
        return $this->_session->getPath() . DIRECTORY_SEPARATOR . 'subscriptions-status.json';
    }

    /**
     * @param string|null $taskId
     * @return string
     */
    public function getProgressPath($taskId=null)
    {
        if (is_null($taskId)) {
            return $this->_session->getPath() . DIRECTORY_SEPARATOR . 'progress.json';
        } else {
            return $this->_session->getPath() . DIRECTORY_SEPARATOR . "progress.$taskId.json";
        }
    }
}
