#pragma once
#include <stdint.h>
#include <string>
#include <vector>
#include "japi/draw.h"

#define COLOR_BLACK 0
#define COLOR_BRIGHT_BLACK 1
#define COLOR_BLUE 2
#define COLOR_BRIGHT_BLUE 3
#define COLOR_RED 4
#define COLOR_BRIGHT_RED 5
#define COLOR_MAGENTA 6
#define COLOR_BRIGHT_MAGENTA 7
#define COLOR_GREEN 8
#define COLOR_BRIGHT_GREEN 9
#define COLOR_CYAN 10
#define COLOR_BRIGHT_CYAN 11
#define COLOR_YELLOW 12
#define COLOR_BRIGHT_YELLOW 13
#define COLOR_WHITE 14
#define COLOR_BRIGHT_WHITE 15

struct enemy_t
{
    std::string animation {""};
    uint8_t x {0};
    uint8_t y {0};
    float vx {0.0f};
    float vy {0.0f};
    uint8_t x1 {0};
    uint8_t y1 {0};
    uint8_t x2 {0};
    uint8_t y2 {0};
    uint8_t color {COLOR_WHITE};
    bool flip {false};
    bool mirror {false};
};

struct item_t
{
    uint8_t tile {0};
    uint8_t x {0};
    uint8_t y {0};
    float counter {0.0f};
};

struct room_t
{
    std::string name {""};
    uint8_t bgColor {COLOR_BLACK};
    uint8_t border {COLOR_BLACK};
    draw::surface *tileSetFile {nullptr};
    std::string roomUp {0};
    std::string roomDown {0};
    std::string roomLeft {0};
    std::string roomRight {0};
    uint8_t itemColor1 {0};
    uint8_t itemColor2 {0};
    std::vector<enemy_t> enemies;
    std::vector<item_t> items;
    uint16_t tiles[32][16];
};

namespace rooms
{
    void load();
    void draw();
}
