#pragma once

#include <cstdint>

struct ColorHSV
{
  float h, s, v;
};

inline ColorHSV operator*(const ColorHSV &c, float scalar)
{

  return {scalar * c.h,
          scalar * c.s,
          scalar * c.v};
}

inline ColorHSV operator*(float scalar, const ColorHSV &c)
{
  return {scalar * c.h,
          scalar * c.s,
          scalar * c.v};
}

inline ColorHSV operator+(const ColorHSV &c1, const ColorHSV &c2)
{
  return {
      c1.h + c2.h,
      c1.s + c2.s,
      c1.v + c2.v};
}

inline ColorHSV interpolate(const ColorHSV &c1, const ColorHSV &c2, float f)
{
  return ColorHSV{
      (1.0f - f) * c1.h + f * c2.h,
      (1.0f - f) * c1.s + f * c2.s,
      (1.0f - f) * c1.v + f * c2.v};
}

#ifndef PLATFORM_NATIVE
inline void print(const char *prefix, const ColorHSV &c)
{
  Serial.printf("%s HSV(%f, %f, %f)\n", prefix, c.h, c.s, c.v);
}
#endif
