using namespace std;

#ifndef EPPJ_HPP
    #define EPPJ_HPP

#include <string>
#include <vector>
#include <algorithm>

enum TFile_Type { FT_Unknown, FT_List, FT_Directory, FT_Password };

class TPrayer_List;

class TPrayer_Item
{
public:
    TPrayer_Item();

    string ID; /* Unique ID */
    string Title; /* Prayer request title */
    string Text; /* Prayer request text */
    string More; /* URL for more information */
    string Image; /* URL for image */
    string Answered; /* "answered" text */
    string _Set; /* Name of set */
    string Startdate; /* Date or start date */
    string enddate; /* end date */
    string Urgent; /* Text indicating urgency */
    bool Hidden;
    TPrayer_List* Parent; /* Prayer list containing item */
    int Tag; /* For developer use */

    /* Should pass False if not storing data securely */
    string Serialize();
};

class TEPPJ_File
{
public:
    TFile_Type File_Type;

    TEPPJ_File() { File_Type = FT_Unknown; };

    virtual int Count();
};

class TSecurity : public TEPPJ_File
{
public:
    TSecurity();
};

class TPrayer_List : public TEPPJ_File
{
public:
    TPrayer_List();
    ~TPrayer_List();

private:
    vector<void*> _List;

protected:
    vector<void*> List();

public:
    TPrayer_Item* Get_Item(int Index);
    void Set_Item(int Index, TPrayer_Item* Value);

public:
    string URL;
    string Password; /* Reserved for client to save */

    int Count();
    int Add(TPrayer_Item* Value);
    void Delete(int Value);

    /* Should pass False if not storing data securely */
    string Serialize(bool Include_Password = true);
};


class TDirectory_Entry
{
public:
    TDirectory_Entry();
    string Name;
    string URL;
    int Tag; /* For developer use */
};

class TDirectory : public TEPPJ_File
{
public:
    TDirectory();
    ~TDirectory();

private:
    vector<void*> _List;

protected:
    vector<void*> List();

public:
    int Add(TDirectory_Entry* Value);
    int Count();
    string Name(int Index);
    string URL(int Index);
    TDirectory_Entry* Entry(int Index);
    int Indexof_Name(string S);
};

class TURL_Source
{
public:
    TURL_Source() {};

    virtual string Get_Text(string URL);
};

extern TEPPJ_File* Load_EPPJ(const string URL, TURL_Source* Source,
    bool Redirection = false, bool Load_Balance = false);
extern TEPPJ_File* Parse_File(string S, TURL_Source* Source,
    bool Redirection = false, bool Load_Balance = false);
extern TURL_Source* URL_Source();
#endif
