#ifndef EDITPATIENTFORM_H
#define EDITPATIENTFORM_H

#include <QWidget>

namespace Ui {
class EditPatientForm;
}

#define ADD_PATIENT()\
ADD_PATIENT_PROPERTY(ID)\
ADD_PATIENT_PROPERTY(Name)\
ADD_PATIENT_PROPERTY(BirthDate)\
ADD_PATIENT_PROPERTY(Sex)\
ADD_PATIENT_PROPERTY(AddDate)\
ADD_PATIENT_PROPERTY(Comment)\
ADD_PATIENT_PROPERTY(Flag)

#define EDIT_PATIENT()\
ADD_PATIENT_PROPERTY(PatientUID)\
ADD_PATIENT()




enum PatientInformationEnum{
#define ADD_PATIENT_PROPERTY(val) val,
    EDIT_PATIENT()
#undef ADD_PATIENT_PROPERTY
};

class PatientInformation:public QObject{
Q_OBJECT
public:
#define ADD_PATIENT_PROPERTY(val) QString val;
    EDIT_PATIENT();
#undef ADD_PATIENT_PROPERTY
    PatientInformation(){
        this->Flag = QString("0");
    }
    PatientInformation* Copy()
    {
        PatientInformation* n=new PatientInformation;
        n->PatientUID = this->PatientUID;
        n->ID = this->ID;
        n->Name = this->Name;
        n->BirthDate = this->BirthDate;
        n->Sex = this->Sex;
        n->Comment = this->Comment;
        return n;
    }
};

class QToolButton;
class EditPatientForm : public QWidget
{
    Q_OBJECT

public:
    explicit EditPatientForm(QWidget *parent = nullptr);
    ~EditPatientForm();
    void setPatientInformation(PatientInformation * information);
    PatientInformation * getPatientInformation(){
        return &store;
    }
    void clearPatientInformation();
    void storePatientInformation();
    void restorePatientInformation();
    void setEditEnable(bool enable);
    signals:
    void editAccept(PatientInformation * detail,bool & accept);
    void editCancel();
    signals:
    void hideBtnClicked();
private:
    Ui::EditPatientForm *ui;
    QString currentPatientUID;
    QString AddDate;
    PatientInformation store;
    bool editEnable=false;
    QToolButton* btnEditAccept;
    QToolButton* btnEditCancel;
    QToolButton* btnFemale;
    QToolButton* btnMale;
};

#endif // EDITPATIENTFORM_H
