BareGit
#pragma once

#include <cstdint>
#include <string>

#include <mw/error.hpp>

#include "authorization.h"
#include "data.h"
#include "markdown_renderer.h"

/// Validate and coordinate dynamic series mutations.
class SeriesService
{
public:
    /// Construct a series service from its persistence and game boundaries.
    explicit SeriesService(DataSourceInterface& data_source);

    /// Create a series and return its internal ID.
    mw::E<std::int64_t> create(
        std::int64_t actor_user_id,
        std::string game_short_name,
        std::string name,
        std::string description);

    /// Edit a series without changing its owning game.
    mw::E<void> update(
        std::int64_t actor_user_id,
        std::int64_t series_id,
        std::string name,
        std::string description);

    /// Delete a series and its membership rows.
    mw::E<void> remove(
        std::int64_t actor_user_id,
        std::int64_t series_id);

private:
    DataSourceInterface& data_source_;
    AuthorizationService authorization_;
    MarkdownRenderer markdown_renderer_;
};