#ifndef PM_HDU_H
#define PM_HDU_H

// An instance of the FITS Header Data Unit
typedef struct
{
    psString extname;                   // The extension name
    bool phu;                           // Is this the FITS Primary Header Unit
    psMetadata *format;                 // The camera format
    psMetadata *header;                 // The FITS header, or NULL if primary for FITS; or section info
    psArray *images;                    // The pixel data
    psArray *weights;                   // The pixel data
    psArray *masks;                     // The pixel data
    psArray *table;                     // The table data
}
pmHDU;


// Allocators
pmHDU *pmHDUAlloc(const char *extname);

// Read the header
bool pmHDUReadHeader(pmHDU *hdu,        // HDU for which to read header
                     psFits *fits       // FITS file from which to read
                    );

// Read the HDU
bool pmHDURead(pmHDU *hdu,              // HDU to read
               psFits *fits             // FITS file to read from
              );

// Write the HDU
bool pmHDUWrite(pmHDU *hdu,             // HDU to write
                psFits *fits            // FITS file to write to
               );

#endif
