#ifndef PP_MERGE_OPTIONS_H
#define PP_MERGE_OPTIONS_H

#include <pslib.h>
#include <psmodules.h>

// Mode of on/off pairs; the value corresponds to how many images are in each set
typedef enum {
    PP_ONOFF_ABBA = -1,                 // On/off pairs in the ABBA mode
    PP_ONOFF_NONE = 0,                  // No on/off pairs
    PP_ONOFF_ABAB = 1,                  // On/off pairs in the ABAB mode (one image each)
    PP_ONOFF_AABB = 2,                  // On/off pairs, two images each
    // And so on and so forth... just use a number beyond this
} ppOnOff;

// Options for ppMerge
typedef struct {
    psMetadata *format;                 // Camera format configuration
    unsigned int rows;                  // Number of rows to read at once
    float minElectrons;                 // Minimum number of electrons for useful signal
    bool zero;                          // Subtract background before combining?
    bool scale;                         // Scale by the background before combining?
    bool darktime;                      // Normalise by the dark time (time since flush)?
    bool fringe;                        // Make fringe measurements?
    bool shutter;                       // Generate shutter correction?
    bool mask;                          // Generate bad pixel mask?
    unsigned int sample;                // Sampling factor for measuring the background
    psStatsOptions mean;                // Statistic to use to measure the mean
    psStatsOptions stdev;               // Statistic to use to measure the stdev
    int fringeNum;                      // Number of fringe regions per cell
    int fringeSize;                     // Size of fringe regions
    int fringeSmoothX;                  // Number of smoothing regions per cell, in x
    int fringeSmoothY;                  // Number of smoothing regions per cell, in y
    int shutterSize;                    // Size for shutter measurement regions
    int shutterIter;                    // Number of iterations for shutter measurement
    float shutterRej;                   // Rejection limit for shutter measurement
    float maskSuspect;                  // Threshold for identifying suspect pixels
    float maskBad;                      // Threshold for identifying bad pixels
    ppOnOff onOff;                      // On/off pairs?
    pmCombineParams *combine;           // Combination parameters
    psMaskType satMask;                 // Mask value for saturated pixels
    psMaskType badMask;                 // Mask value for bad (low) pixels
} ppMergeOptions;

// Allocator
ppMergeOptions *ppMergeOptionsAlloc(void);


// Parse the options for ppMerge
ppMergeOptions *ppMergeOptionsParse(pmConfig *config // Configuration
    );


#endif
