#include"area_business_work_rate.h"

#include<memory>
#include<string>

#include"log.h"
#include"card.h"
#include"struct_def.h"
#include"three_rates.h"
#include"area.h"
#include"card.h"
#include"tool_time.h"

struct work_rate_data:business_data
{
    work_rate_data()
    {
    }
};

void area_business_work_rate::on_enter(const std::shared_ptr<area_hover>&area_hover_ptr,
                                       const std::shared_ptr<card_location_base>&card_ptr,std::shared_ptr<business_data>& ptr)
{
    if(!card_ptr->is_person())
    {
        return;
    }

    auto card = std::make_shared<card_pos>();
    card->id = card_ptr->m_id;
    card->type = card_ptr->m_type;
    //card->work_line =
    //card->identifier_id

    auto area = std::make_shared<area_data>();
    area->area_id = area_hover_ptr->id();
    //area->is_work_area = area_hover_ptr->m_area->
    area->enter_time = tool_time::now_to_seconds();

    three_rates::get_instance()->enter_area(card, area);
}

void area_business_work_rate::on_hover(const std::shared_ptr<area_hover>&area_hover_ptr,
                                       const std::shared_ptr<card_location_base>&card_ptr,std::shared_ptr<business_data> ptr)
{
}


void area_business_work_rate::on_leave(const std::shared_ptr<area_hover>&area_hover_ptr,
                                       const std::shared_ptr<card_location_base>&card_ptr,std::shared_ptr<business_data> ptr)
{
    if(!card_ptr->is_person())
    {
        return;
    }

    auto card = std::make_shared<card_pos>();
    card->id = card_ptr->m_id;
    card->type = card_ptr->m_type;
    //card->work_line =
    //card->identifier_id

    auto area = std::make_shared<area_data>();
    area->area_id = area_hover_ptr->id();
    //area->is_work_area = area_hover_ptr->m_area->
    area->leave_time = tool_time::now_to_seconds();

    three_rates::get_instance()->leave_area(card, area);
}

