#pragma once

#include <Ship/DecoratedCargo.h>

#include <string>

template <typename ValueType>
class Valuable : public DecoratedCargo {
public:
    Valuable(std::unique_ptr<Cargo>&& cargo, ValueType value)
        : DecoratedCargo(std::move(cargo)), _value(value) {
    }

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

    size_t getPrice() const override {
        return cargo().getPrice() * static_cast<int>(_value);
    }

    const std::string& name() const override {
        return cargo().name();
    }

    void accept(const CargoDamageVisitor& visitor) override {
        cargo().accept(visitor);
    }

private:
    ValueType _value;
};
