kima2/src/core/seller.h

52 lines
1.4 KiB
C++

#ifndef SELLER_H
#define SELLER_H
#include "article.h"
#include "entityint.h"
#include <memory>
#include <string>
#include <vector>
// class Article;
class Seller : public EntityInt
{
public:
Seller() = default;
Seller(const Seller &) = delete;
virtual ~Seller() = default;
Seller(const std::string &firstName, const std::string &lastName, int sellerNo = 0,
int numArticlesOffered = 0);
void setSellerNo(int sellerNo);
void setFirstName(const std::string &firstName);
void setLastName(const std::string &lastName);
void setNumArticlesOffered(int number);
void addArticle(std::unique_ptr<Article> article);
void cleanupArticles();
std::string getFirstName() const;
std::string getLastName() const;
int getSellerNo() const;
std::string getSellerNoAsString() const;
int numArticlesOffered() const;
int numArticlesSold() const;
std::vector<Article *> getArticles(bool onlySold = true) const;
Article *getArticleByUuid(const std::string &uuidString);
int getMaxArticleNo() const;
int sumInCents();
std::string sumAsString();
friend bool operator<(const Seller &li, const Seller &re);
friend bool operator<(const std::unique_ptr<Seller> &li, const std::unique_ptr<Seller> &re);
private:
int m_numArticlesOffered{};
std::string m_firstName{};
std::string m_lastName{};
std::vector<std::unique_ptr<Article>> m_articles{};
};
#endif