package com.moac.android.opensecretsanta.model;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName = Assignment.TABLE_NAME)
public class Assignment extends PersistableObject {

    public enum Status {
        Assigned("Assigned"), Revealed("Revealed"), Sent("Sent"), Failed("Failed");

        private String mText;
        Status(String _text) {  mText = _text; }
        public String getText() { return mText; }
    }

    public static final String TABLE_NAME = "assignments";

    public static interface Columns extends PersistableObject.Columns {
        public static final String GIVER_MEMBER_ID_COLUMN = "GIVER_MEMBER_ID";
        public static final String RECEIVER_MEMBER_ID_COLUMN = "RECEIVER_MEMBER_ID";
        public static final String VIEWED_DATE_COLUMN = "VIEWED_DATE";
        public static final String SENT_DATE_COLUMN = "SENT_DATE";
        public static final String SEND_STATUS_COLUMN = "SEND_STATUS";
    }

    @DatabaseField(columnName = Columns.GIVER_MEMBER_ID_COLUMN, foreign = true, canBeNull = false,
      columnDefinition = "integer references members (_id) on delete cascade")
    private Member mGiver;

    @DatabaseField(columnName = Columns.RECEIVER_MEMBER_ID_COLUMN, foreign = true, canBeNull = false,
      columnDefinition = "integer references members (_id) on delete cascade")
    private Member mReceiver;

    @DatabaseField(columnName = Columns.VIEWED_DATE_COLUMN)
    private long mViewedDate = UNSET_DATE;

    @DatabaseField(columnName = Columns.SENT_DATE_COLUMN)
    private long mSentDate = UNSET_DATE;

    @DatabaseField(columnName = Columns.SEND_STATUS_COLUMN)
    private Status mSendStatus = Status.Assigned;

    public long getGiverMemberId() { return mGiver.getId(); }
    public void setGiverMember(Member _giver) { mGiver = _giver; }

    public long getReceiverMemberId() { return mReceiver.getId(); }
    public void setReceiverMember(Member _receiver) { mReceiver = _receiver; }

    public long getViewedDate() { return mViewedDate; }
    public void setViewedDate(long _viewedDate) { mViewedDate = _viewedDate; }

    public long getSentDate() { return mSentDate; }
    public void setSentDate(long _sentDate) { mSentDate = _sentDate; }

    public Status getSendStatus() { return mSendStatus; }
    public void setSendStatus(Status _sendStatus) { mSendStatus = _sendStatus; }

}

@@ -782,146 +782,8 @@
 D%22;%0A
-        public static final String VIEWED_DATE_COLUMN = %22VIEWED_DATE%22;%0A        public static final String SENT_DATE_COLUMN = %22SENT_DATE%22;%0A
     
@@ -1278,212 +1278,8 @@
 r;%0A%0A
-    @DatabaseField(columnName = Columns.VIEWED_DATE_COLUMN)%0A    private long mViewedDate = UNSET_DATE;%0A%0A    @DatabaseField(columnName = Columns.SENT_DATE_COLUMN)%0A    private long mSentDate = UNSET_DATE;%0A%0A
     
@@ -1678,26 +1678,28 @@
 lic 
-long getViewedDate
+Status getSendStatus
 () %7B
@@ -1707,26 +1707,26 @@
 return m
-ViewedDate
+SendStatus
 ; %7D%0A    
@@ -1744,329 +1744,234 @@
  set
-ViewedDate(long _viewedDate) %7B mViewedDate = _viewedDate; %7D%0A%0A    public long getSentDate() %7B return mSentDate; %7D%0A    public void setSentDate(long _sentDate) %7B mSentDate = _sentDate; %7D%0A%0A    public Status getSendStatus() %7B return mSendStatus; %7D%0A    public void setSendStatus(Status _sendStatus) %7B mSendStatus = _sendStatus;
+SendStatus(Status _sendStatus) %7B mSendStatus = _sendStatus; %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return %22Giver: %22 + getGiverMemberId() + %22 Receiver: %22 + getReceiverMemberId() + %22 Status: %22 + mSendStatus;%0A   
  %7D%0A%0A

Remove view and sent dates from Assignment