#ifndef PRIMITIVES_H
#define PRIMITIVES_H

#include <stdbool.h>

// Waveform data structure (mirrors AudioSignal for scope rendering)
typedef struct {
    float* samples;
    int numSamples;
    int sampleRate;
} WaveformData;

// Scope view state for time/amplitude waveform display
typedef struct {
    WaveformData data;
    
    // View bounds (in pixels)
    int x, y;
    int width, height;
    
    // Time view (0-1 normalized within the signal)
    float viewStart;      // start of visible time
    float viewEnd;        // end of visible time
    
    // Amplitude view
    float ampMin;         // minimum visible amplitude (-1.0 to 1.0)
    float ampMax;         // maximum visible amplitude
    
    // Cursor/selection
    float cursorT;        // 0-1 normalized time position of cursor
    
    // Display settings
    bool showGrid;
    float gridAlpha;      // 0-1 alpha for grid lines
    
    // Background color
    int bgColorR, bgColorG, bgColorB, bgColorA;
    
    // Grid color
    int gridR, gridG, gridB, gridA;
} ScopeView;

// Initialize a scope view with bounds and waveform
void InitScopeView(ScopeView* view, WaveformData data, int x, int y, int width, int height);

// Draw the scope view with optional cursor/playhead
void DrawScopeView(ScopeView* view, float cursorT);

#endif // PRIMITIVES_H
