package com.martindisch.chronoscopy.logic;

import com.orm.SugarRecord;

/**
 * Represents a usage of an activity, with a date and duration.
 */
public class ChrUsage extends SugarRecord {

    private ChrActivity activity;
    private String date;
    private String time;

    /**
     * Default constructor, necessary for SugarRecord.
     */
    public ChrUsage() {}

    /**
     * Instantiate a new activity usage.
     *
     * @param activity Reference to the activity
     * @param date The date in ISO 8601 (YYYY-MM-DD)
     * @param time The duration in minutes or h:mm/hh:mm
     */
    public ChrUsage(ChrActivity activity, String date, String time) {
        this.activity = activity;
        this.date = date;
        this.time = time;
    }

    public ChrActivity getActivity() {
        return activity;
    }

    public void setActivity(ChrActivity activity) {
        this.activity = activity;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }
}

@@ -195,27 +195,20 @@
 private 
-ChrActivity
+long
  activit
@@ -204,24 +204,26 @@
 ong activity
+Id
 ;%0A    privat
@@ -442,21 +442,16 @@
 vity
- Reference to
+Id Id of
  the
@@ -598,27 +598,20 @@
 hrUsage(
-ChrActivity
+long
  activit
@@ -611,16 +611,18 @@
 activity
+Id
 , String
@@ -656,32 +656,34 @@
    this.activity
+Id
  = activity;%0A   
@@ -673,24 +673,26 @@
 d = activity
+Id
 ;%0A        th
@@ -751,27 +751,20 @@
  public 
-ChrActivity
+long
  getActi
@@ -767,16 +767,18 @@
 Activity
+Id
 () %7B%0A   
@@ -789,32 +789,34 @@
  return activity
+Id
 ;%0A    %7D%0A%0A    pub
@@ -840,19 +840,12 @@
 ity(
-ChrActivity
+long
  act
@@ -849,16 +849,18 @@
 activity
+Id
 ) %7B%0A    
@@ -876,16 +876,18 @@
 activity
+Id
  = activ
@@ -889,16 +889,18 @@
 activity
+Id
 ;%0A    %7D%0A

Store activity id directly to prevent issues