kima2/src/core/seller.h

51 lines
1.4 KiB
C
Raw Normal View History

2018-07-09 16:06:27 +02:00
#ifndef SELLER_H
#define SELLER_H
#include "article.h"
2018-07-11 11:53:46 +02:00
#include "entity.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>
//class Article;
2018-07-09 16:06:27 +02:00
class Seller : public Entity
{
public:
2018-07-20 11:52:26 +02:00
Seller() = default;
//virtual ~Seller() = default;
2018-07-11 11:53: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);
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-07-12 14:39:08 +02:00
int numArticlesOffered() const;
int numArticlesSold() const;
2018-07-13 13:54:02 +02:00
// int numArticlesTotal() const;
2018-07-12 14:39:08 +02:00
std::vector<Article*> getArticles(bool onlySold = true) const;
2018-07-25 09:31:17 +02:00
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
2018-07-18 09:00: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-09 16:06:27 +02:00
private:
2018-07-10 12:51:03 +02:00
int sellerNo_{-1};
2018-07-12 14:39:08 +02:00
int numArticlesOffered_{};
2018-07-10 12:51:03 +02:00
std::string firstName_{};
std::string lastName_{};
2018-07-20 11:52:26 +02:00
std::vector<std::unique_ptr<Article>> articles_{};
2018-07-09 16:06:27 +02:00
};
#endif