#pragma once

#include <memory>
#include <vector>
#include <cstdint>

class Color
{
public:
    Color(unsigned r = 0, unsigned g = 0, unsigned b = 0, double a = 1.0);

    static std::shared_ptr<Color> CreateShared(unsigned r, unsigned g, unsigned b, double a = 1.0);
    static std::unique_ptr<Color> Create(unsigned r, unsigned g, unsigned b, double a = 1.0);
    static std::unique_ptr<Color> Create(const Color& color);

    unsigned getR() const;
    unsigned getG() const;
    unsigned getB() const;
    double getAlpha() const;

    bool operator==(const Color& rhs) const
    {
       return (mR == rhs.mR)
       && (mG == rhs.mG)
       && (mB == rhs.mB)
       && (mAlpha == rhs.mAlpha);
    }

    bool operator!=(const Color& rhs) const
    {
      return !operator==(rhs);
    }

    std::vector<double> getAsVectorDouble() const
    {
        return {mR/255.0, mG/255.0, mB/255.0, mAlpha};
    }

    uint32_t getAsUInt32() const
    {
        return mB + (mG<<8) + (mR<<16);
    }

private:
    unsigned mR{0};
    unsigned mG{0};
    unsigned mB{0};
    double mAlpha{0.0};
};

using ColorPtr = std::shared_ptr<Color>;
using ColorUPtr = std::unique_ptr<Color>;
