#ifndef RAWCHIP_H
#define RAWCHIP_H

#include "RawReadout.h"

class RawChip : public TObject
{

 public:

  typedef enum EChipStatus {
    kGood = 0x00,
    kBad  = 0x01,
    kCold = 0x02,
    kHot = 0x03,
    kBusy = 0x04,
    kError = 0x05
  } ChipStatus_t;

  RawChip(RawChannelId rawch, Int_t adc, Int_t tdc, RawReadout::ReadoutType_t readout, RawChip::ChipStatus_t status, Int_t errcode);
  RawChip(const RawChip& rhs);
  ~RawChip();

  void AddChannel(RawChannelId rawch, Int_t adc, Int_t tdc, Int_t errcode);
  void AddChannel(RawChannelId rawch);

  RawChannelId GetChannelId() const;
  Int_t GetAdc() const;
  Int_t GetTdc() const;
  Int_t GetNanosec() const;
  RawReadout::ReadoutType_t GetReadoutType() const;
  RawChip::ChipStatus_t GetChipStatus() const;
  Int_t GetErrorCode() const;
  
  Int_t GetElecType() const;
  Int_t GetCrate() const;

  Int_t GetVarc() const;
  Int_t GetVmm() const;
  Int_t GetVaadc() const;
  Int_t GetVaChip() const;
  Int_t GetVaChannel() const;
  Int_t GetVaChannelWord() const;
  Int_t GetVaPriority() const;
    
  Int_t GetMaster() const;
  Int_t GetMinder() const;
  Int_t GetMenu() const;

  Bool_t IsSameElecType(RawChannelId rawch) const;
  Bool_t IsSameElecType(RawChip* chip) const;

  Bool_t IsSameCrate(RawChannelId rawch) const;
  Bool_t IsSameCrate(RawChip* chip) const;

  Bool_t IsSameVarc(RawChannelId rawch) const;
  Bool_t IsSameVmm(RawChannelId rawch) const;
  Bool_t IsSameVaadc(RawChannelId rawch) const;
  Bool_t IsSameVaChip(RawChannelId rawch) const;

  Bool_t IsSameVarc(RawChip* chip) const;
  Bool_t IsSameVmm(RawChip* chip) const;
  Bool_t IsSameVaadc(RawChip* chip) const;
  Bool_t IsSameVaChip(RawChip* chip) const;

  Bool_t IsSameMaster(RawChannelId rawch) const;
  Bool_t IsSameMinder(RawChannelId rawch) const;
  Bool_t IsSameMenu(RawChannelId rawch) const;
  
  Bool_t IsSameMaster(RawChip* chip) const;
  Bool_t IsSameMinder(RawChip* chip) const;
  Bool_t IsSameMenu(RawChip* chip) const;

  Bool_t IsSameChip(RawChannelId rawch) const;
  Bool_t IsSameChip(RawChip* chip) const;

 private:
  
  RawChannelId fRawChannelId;
  Int_t fAdc;
  Int_t fTdc;
  RawReadout::ReadoutType_t fReadout;
  RawChip::ChipStatus_t fStatus;
  Int_t fErrorCode;
  Int_t fChannelWord;

ClassDef(RawChip,1)

};

#endif
