2018-07-09 16:06:27 +02:00
|
|
|
#ifndef SELLER_H
|
|
|
|
#define SELLER_H
|
|
|
|
|
|
|
|
#include "article.h"
|
2019-10-04 15:15:43 +02:00
|
|
|
#include "entityint.h"
|
2018-07-09 16:06:27 +02:00
|
|
|
|
2018-07-12 08:26:03 +02:00
|
|
|
#include <memory>
|
2018-07-09 16:06:27 +02:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2018-10-12 11:49:52 +02:00
|
|
|
// class Article;
|
2018-07-09 16:06:27 +02:00
|
|
|
|
2019-10-04 15:15:43 +02:00
|
|
|
class Seller : public EntityInt
|
2018-07-09 16:06:27 +02:00
|
|
|
{
|
2022-07-07 15:21:46 +02:00
|
|
|
public:
|
2018-07-20 11:52:26 +02:00
|
|
|
Seller() = default;
|
2022-07-07 15:21:46 +02:00
|
|
|
Seller(const Seller &) = delete;
|
2019-10-07 08:32:37 +02:00
|
|
|
virtual ~Seller() = default;
|
2022-07-07 15:21:46 +02:00
|
|
|
Seller(const std::string &firstName, const std::string &lastName, int sellerNo = 0,
|
2018-07-12 14:39:08 +02:00
|
|
|
int numArticlesOffered = 0);
|
2018-07-11 13:25:39 +02:00
|
|
|
|
2018-07-09 16:06:27 +02:00
|
|
|
void setSellerNo(int sellerNo);
|
2022-07-07 15:21:46 +02:00
|
|
|
void setFirstName(const std::string &firstName);
|
|
|
|
void setLastName(const std::string &lastName);
|
2018-07-12 14:39:08 +02:00
|
|
|
void setNumArticlesOffered(int number);
|
2018-07-20 11:52:26 +02:00
|
|
|
void addArticle(std::unique_ptr<Article> article);
|
2018-07-13 13:54:02 +02:00
|
|
|
void cleanupArticles();
|
2018-07-09 16:06:27 +02:00
|
|
|
|
2018-07-11 15:59:38 +02:00
|
|
|
std::string getFirstName() const;
|
|
|
|
std::string getLastName() const;
|
|
|
|
int getSellerNo() const;
|
2018-10-12 11:47:03 +02:00
|
|
|
std::string getSellerNoAsString() const;
|
2018-07-12 14:39:08 +02:00
|
|
|
int numArticlesOffered() const;
|
|
|
|
int numArticlesSold() const;
|
2022-07-07 15:21:46 +02:00
|
|
|
std::vector<Article *> getArticles(bool onlySold = true) const;
|
|
|
|
Article *getArticleByUuid(const std::string &uuidString);
|
2018-07-22 20:10:22 +02:00
|
|
|
int getMaxArticleNo() const;
|
2018-07-30 09:50:54 +02:00
|
|
|
int sumInCents();
|
|
|
|
std::string sumAsString();
|
2018-07-09 16:06:27 +02:00
|
|
|
|
2022-07-07 15:21:46 +02:00
|
|
|
friend bool operator<(const Seller &li, const Seller &re);
|
|
|
|
friend bool operator<(const std::unique_ptr<Seller> &li, const std::unique_ptr<Seller> &re);
|
2018-07-18 09:00:46 +02:00
|
|
|
|
2022-07-07 15:21:46 +02:00
|
|
|
private:
|
|
|
|
int m_numArticlesOffered{};
|
|
|
|
std::string m_firstName{};
|
|
|
|
std::string m_lastName{};
|
|
|
|
std::vector<std::unique_ptr<Article>> m_articles{};
|
2018-07-09 16:06:27 +02:00
|
|
|
};
|
|
|
|
|
2019-10-04 14:05:19 +02:00
|
|
|
#endif
|