/*
* Copyright (C) 2018 Emeric Poupon
*
* This file is part of LMS.
*
* LMS 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.
*
* LMS 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 LMS. If not, see .
*/
#pragma once
#include
#include
#include
#include
#include "Types.hpp"
namespace Database {
class Track;
class ClusterType;
class ScanSettings;
class Cluster : public Wt::Dbo::Dbo
{
public:
using pointer = Wt::Dbo::ptr;
Cluster();
Cluster(Wt::Dbo::ptr type, std::string name);
// Find utility
static std::vector getAll(Wt::Dbo::Session& session);
static std::vector getAllOrphans(Wt::Dbo::Session& session);
static pointer getById(Wt::Dbo::Session& session, IdType id);
// Create utility
static pointer create(Wt::Dbo::Session& session, Wt::Dbo::ptr type, std::string name);
// Accessors
const std::string& getName() const { return _name; }
Wt::Dbo::ptr getType() const { return _clusterType; }
std::size_t getTracksCount() const { return _tracks.size(); }
std::vector> getTracks(int offset, int limit) const;
std::set getTrackIds() const;
std::size_t getReleasesCount() const;
void addTrack(Wt::Dbo::ptr