#pragma once

#include "render/core/mat3.h"
#include "render/core/shader_program.h"

#include <GLES2/gl2.h>

struct ScreenCornerStyle;

class ScreenCornerProgram {
public:
  ScreenCornerProgram() = default;
  ~ScreenCornerProgram() = default;

  ScreenCornerProgram(const ScreenCornerProgram&) = delete;
  ScreenCornerProgram& operator=(const ScreenCornerProgram&) = delete;

  void ensureInitialized();
  void destroy();
  void abandon() noexcept;

  void draw(
      float surfaceWidth, float surfaceHeight, float width, float height, const ScreenCornerStyle& style,
      const Mat3& transform = Mat3::identity()
  ) const;

private:
  ShaderProgram m_program;
  GLint m_positionLocation = -1;
  GLint m_surfaceSizeLocation = -1;
  GLint m_sizeLocation = -1;
  GLint m_colorLocation = -1;
  GLint m_cornerLocation = -1;
  GLint m_exponentLocation = -1;
  GLint m_transformLocation = -1;
};
