﻿using UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;
using Waterboost;
/// <summary>
/// Empty class for future functionality
/// </summary>
public class OfflineUser : IUser
{

	private IDailyWaterConsumption dailyWaterConsumption;
	private IHistory dailyWaterConsumptionHistory;
	#region IUser implementation
	
	public OfflineUser() {
		dailyWaterConsumption = new DailyWaterConsumption ();
		dailyWaterConsumptionHistory = new OfflineHistory();
		dailyWaterConsumptionHistory.pull();
		
		IHistoryDayEntry h = dailyWaterConsumptionHistory.getForDay(DateTime.Today);
		if (h != null) {
			dailyWaterConsumption = h.getDailyWaterConsumption();
		}
		Debug.Log ("OfflineUser() created!");
	}

	virtual public IDailyWaterConsumption getDailyConsumption ()
	{
		return dailyWaterConsumption;
	}

	virtual public IHistory getHistory() {
		return dailyWaterConsumptionHistory;
	}

	public IUserProfileData getUserProfile ()
	{
		throw new NotImplementedException ();
	}

	private OnUserSynced mOnUserSynced;
	public void sync ()
	{
		dailyWaterConsumptionHistory.pull();
		dailyWaterConsumptionHistory.replaceEntryBy(new HistoryEntry(DateTime.Now, dailyWaterConsumption));
		dailyWaterConsumptionHistory.push();
		if (mOnUserSynced != null) {
			mOnUserSynced();
		}
	}
	event OnUserSynced IUser.EventSync
	{
		add { mOnUserSynced += value; }
		remove { mOnUserSynced -= value; }
	}

	#endregion
    
    public int getDrinkedWater()
    { 
        return 0;
    }
    
    public string getUUID()
    { 
        return "";
    }
}
