#ifndef Interaction_h_DEFINED
#define Interaction_h_DEFINED

#include "../const.h"
#include <stdlib.h>
#include "Emotion.h"
#include "../Interaction/Init_per_para.h"

// Defining new type 'state'
enum state {AIBO_NEUTRAL, AIBO_JOYFUL, AIBO_SAD, AIBO_ANGRY};

// Defining new type 'input'
enum input {USER_NEUTRAL, USER_JOYFUL, USER_SAD, USER_SURPRISED,
            USER_ANGRY, USER_FEARFUL, USER_DISGUSTED};

struct Personality {

       state initial_state;
       state current_state;
       float nice_interaction_points;
       float sad_interaction_points;
       float bad_interaction_points;
       float*** transition_prob;     // probabilistic transition probabilities

       Personality() {
          initial_state = current_state = AIBO_NEUTRAL;
          nice_interaction_points = sad_interaction_points = bad_interaction_points = 0.0;

          transition_prob = (float***) calloc(STATE_NUM, sizeof(float**));
          for (int i = 0; i < STATE_NUM; i++) {
              transition_prob[i] = (float**) calloc(EM_NUM + 1, sizeof(float*));
              for (int j = 0; j < EM_NUM + 1; j++) {
                  transition_prob[i][j] = (float*) calloc(STATE_NUM, sizeof(float));
              }
          }

                     	
       }

};

bool InitPersonality(Personality& p, const Init_per_para& parameters);
bool Interact(Personality& p, Emotion& emotion, const Init_per_para& parameters);
void UpdatePersonality(Personality& p, Emotion& emotion, const Init_per_para& parameters);
void UpdatePersonalityImitating(Personality& p, const Init_per_para& parameters);
void UpdatePersonalityCompensating(Personality& p, const Init_per_para& parameters);
bool CheckProb(const Personality& p);
void FreePersonality(Personality& p);



#endif // Interaction_h_DEFINED
