#pragma once

#include <Arduino.h>
#include <FastLED.h>
#include "ColorPalettes.h"

#define PIXEL_INDEX -3
#define SOLID_COLOR_INDEX -2
#define OFF_INDEX -1

extern uint32_t whiteTimeout;

typedef struct {
    int AnimationIndex;
    union {
        struct {
            uint8_t red;
            uint8_t grn;
            uint8_t blu;
            uint8_t wht;
            uint8_t extra[4];  // 4 extra bytes
        };
        uint8_t rgb[3];       // Access RGB only
        uint8_t rgbw[4];      // Access RGBW
        uint8_t data[8];      // Access all 8 bytes
    } data;
} ANIM_EVENT;

typedef struct {
    CRGB* leds;
    bool enabled;
    int size;
    String chip;
    String rgbOrder;
    int shift;
    int offset;
    int powerDiv;
    int effSize;
    uint8_t bright;
    uint8_t i2sCh;
    uint8_t core;
    uint8_t pin;
}LEDSTRIP_SETTINGS;

extern LEDSTRIP_SETTINGS ledSettings[2];

// Forward declarations
//extern CRGB* leds1;
//extern CRGB* leds2;

void Lights_Control_Task(void *parameters);
void Init_Lights_Task(void);
void Lights_Control_Task_Resume(void);
void Init_Strip(CRGB* leds, uint8_t pin, int size, const String& colorOrder, const String& chipType, uint8_t bright);

EOrder GetEOrderByString(const String& rgbStr);

void Lights_Set_Animation(int animIndex, uint8_t red, uint8_t grn, uint8_t blu);
void Lights_Set_ON(void);
void Lights_Set_OFF(void);
void Lights_Set_Brightness(uint8_t scale);
void Lights_Set_White(uint8_t val);
void createFirePalette(CRGBPalette16& palette, CRGB color1, CRGB color2, CRGB color3);
void loadColorPack(COLOR_PACK& dest, const COLOR_PACK& src);















