// Copyright (C) 2024-2025 Simon Quigley <tsimonq2@ubuntu.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.

#ifndef LUBUNTUCI_LIB_H
#define LUBUNTUCI_LIB_H

#include <string>
#include <vector>
#include "ci_logic.h"

class LubuntuCI {
public:
    /**
     * List all known repositories from the merged config.
     */
    std::vector<std::shared_ptr<PackageConf>> list_known_repos(int page = 0,
                                                               int per_page = 0,
                                                               const std::string& sort_by = "",
                                                               const std::string& sort_order = "");

    /**
     * Pull a specific repository by name (returns true on success).
     */
    bool pull_repo(const std::string &repo_name, std::shared_ptr<Log> log = NULL);

    bool create_project_tarball(const std::string &repo_name, std::shared_ptr<Log> log);

    /**
     * Build a specific repository by name (returns true on success).
     */
    bool build_repo(const std::string &repo_name, std::shared_ptr<Log> log = NULL);

    /**
     * Retrieve the most recent commit log from a named repo.
     */
    std::string get_repo_log(const std::string &repo_name);

    CiLogic cilogic = CiLogic();
};

#endif // LUBUNTUCI_LIB_H