summaryrefslogtreecommitdiff
path: root/include/book_store/customer.hh
blob: 86f3df66d796e11043caba75c3ed56068d176ce5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef MEMBER_HH
#define MEMBER_HH

#include <cstddef>

#include "book.hh"
#include "person.hh"
#include "price.hh"

namespace book_store::consumer {
class customer : public person {

private:
  product::book::book::size_type _books_bought;
  product::price::usd _amount_spent;
  bool _is_member;

public:
  customer(std::string first_name, std::string last_name, std::size_t member_id)
      : person(std::move(first_name), std::move(last_name), member_id),
        _books_bought(0), _amount_spent(0) {}
  customer(std::string first_name, std::string last_name, std::size_t member_id,
           bool is_member)
      : person(std::move(first_name), std::move(last_name), member_id),
        _is_member(is_member) {}
  customer(std::string first_name, std::string last_name, std::size_t member_id,
           bool is_member, product::book::size_type books_bought,
           product::price::usd amount_spent)
      : person(std::move(first_name), std::move(last_name), member_id),
        _books_bought(books_bought), _amount_spent(amount_spent),
        _is_member(is_member) {}
  customer() = default;
  customer(const customer &) = default;
  customer(customer &&) = default;

  [[nodiscard]] auto books_bought() const noexcept -> product::book::size_type;
  [[nodiscard]] auto amount_spent() const noexcept -> product::price::usd;
  [[nodiscard]] auto is_member() const noexcept -> bool;

  auto books_bought(product::book::size_type books_bought) noexcept -> void;
  auto amount_spent(product::price::usd amount_spent) noexcept -> void;
  auto is_member(bool is_member) noexcept -> void;

  auto operator=(const customer &) -> customer & = default;
  auto operator=(customer &&) -> customer & = default;
};
} // namespace book_store::consumer

#endif // MEMBER_HH