#ifndef BOOK_HH #define BOOK_HH #include #include #include #include #include "book_count.hh" #include "person.hh" #include "price.hh" namespace book_store::product { class book { public: using size_type = book_count; using price_type = price::usd; private: std::string _title; std::vector _authors; std::string _publisher; std::string _isbn; price_type _price_usd; size_type _copies; public: book(std::string title, std::vector authors, std::string publisher, std::string isbn, price::usd price, size_type copies) : _title(std::move(title)), _authors(std::move(authors)), _publisher(std::move(publisher)), _isbn(std::move(isbn)), _price_usd(price), _copies(copies) {} book() noexcept : _authors({}), _price_usd(0.0), _copies(0) {} book(const book &) noexcept = default; book(book &&) noexcept = default; [[nodiscard]] auto title() const noexcept -> std::string_view; [[nodiscard]] auto authors() const noexcept -> std::vector; [[nodiscard]] auto publisher() const noexcept -> std::string_view; [[nodiscard]] auto isbn() const noexcept -> std::string_view; [[nodiscard]] auto price_usd() const noexcept -> price_type; [[nodiscard]] auto copies() const noexcept -> size_type; auto title(std::string_view title) noexcept -> book &; auto authors(std::vector authors) -> book &; auto author(const consumer::person &author) -> book &; auto remove_author_by_id(std::size_t author_id) -> book &; auto publisher(std::string_view publisher) noexcept -> book &; auto isbn(std::string_view isbn) noexcept -> book &; auto price_usd(price_type price) noexcept -> book &; auto copies(size_type copies) noexcept -> book &; auto operator=(const book &) -> book & = default; auto operator=(book &&) -> book & = default; friend auto operator<<(std::ostream &output_stream, const book &book) -> std::ostream &; }; } // namespace book_store::product #endif // BOOK_HH