#include "Ship/DecoratedCargo.h"

#include <Core/TimeObserver.h>

class Time;

class Vulnerable : public DecoratedCargo, public TimeObserver {
public:
    Vulnerable(std::unique_ptr<Cargo>&& cargo, Time* time, int durability, int maxDurability);

    Vulnerable(const Vulnerable&) = default;
    Vulnerable(Vulnerable&&) = default;
    Vulnerable& operator=(const Vulnerable&) = default;
    Vulnerable& operator=(Vulnerable&&) = default;
    ~Vulnerable();

    size_t amount() const override { return cargo().amount(); }
    size_t& amount() override { return cargo().amount(); }

    void nextDay() override;
    size_t getPrice() const override;
    const std::string& name() const override;
    void accept(const CargoDamageVisitor& visitor) override;

private:
    Time* _time;
    int _durability;
    int _maxDurability;
};