/*
 * MIT License
 * Author: Mark Allyn
 *
 * scope_marine_ppi.h — Marine PPI scope.
 *
 * Fixed mid-bay platform at Bellingham Bay (fictitious 100-foot platform).
 * Radar origin: 48.7436°N, 122.5647°W.
 * Sweep period: 4 seconds (clockwise).
 * P7 phosphor: blue strike → green → yellow-green → dark.
 * Max range steps: 2 / 4 / 6 miles.
 * Range rings (beam-painted): see settings.h MARINE_RING_MILES table.
 * Land/terrain clutter: deferred (not included in this phase).
 * Targets: AIS data + simulator-generated vessels and small craft.
 */

#pragma once
#include "scope_ppi.h"

class MarinePPIScope : public PPIScope {
public:
    MarinePPIScope(SharedRenderState& srs, TargetBuffer& tb, TextRenderer& tr)
        : PPIScope(srs, tb, tr, MARINE_PPI_SWEEP_PERIOD)
    {
        maxRangeIdx_  = MARINE_PPI_DEFAULT_RANGE_IDX;
        cursorBrgDeg_ = MARINE_PPI_DEFAULT_CURSOR_BRG;
        cursorRngMi_  = MARINE_PPI_DEFAULT_CURSOR_RNG;
        brgOffsetDeg_ = MARINE_PPI_DEFAULT_BRG_OFFSET;
        computeRingRadii();
    }

    std::string getName() const override { return "Marine PPI"; }

protected:
    float        maxRangeM()  const override;
    const float* ringRadii()  const override { return ringRadiiNorm_; }
    int          ringCount()  const override { return MARINE_RING_COUNT[maxRangeIdx_]; }
    void         handleKeyRange(int key, int action) override;
    std::vector<std::string> panelLines() const override;

private:
    int   maxRangeIdx_ = MARINE_PPI_DEFAULT_RANGE_IDX;
    float ringRadiiNorm_[2] = {};   // up to 2 rings per range setting

    void computeRingRadii();
};
