/*
 * Copyright (c) 2017, University of Oslo
 *
 * All rights reserved.
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 *
 * Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 * Neither the name of the HISP project nor the names of its contributors may
 * be used to endorse or promote products derived from this software without
 * specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package org.hisp.dhis.android.core.event;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import org.hisp.dhis.android.core.common.DeletableStore;
import org.hisp.dhis.android.core.common.State;
import org.hisp.dhis.android.core.common.StoreWithState;

import java.util.Date;
import java.util.List;
import java.util.Map;

public interface EventStore extends DeletableStore, StoreWithState {
    long insert(@NonNull String uid,
                @Nullable String enrollmentUid,
                @NonNull Date created,
                @NonNull Date lastUpdated,
                @Nullable String createdAtClient,
                @Nullable String lastUpdatedAtClient,
                @NonNull EventStatus status,
                @Nullable String latitude,
                @Nullable String longitude,
                @NonNull String program,
                @NonNull String programStage,
                @NonNull String organisationUnit,
                @Nullable Date eventDate,
                @Nullable Date completedDate,
                @Nullable Date dueDate,
                @NonNull State state,
                @NonNull String attributeOptionCombo,
                @Nullable String trackedEntityInstance
    );

    int update(@NonNull String uid,
               @Nullable String enrollmentUid,
               @NonNull Date created,
               @NonNull Date lastUpdated,
               @Nullable String createdAtClient,
               @Nullable String lastUpdatedAtClient,
               @NonNull EventStatus eventStatus,
               @Nullable String latitude,
               @Nullable String longitude,
               @NonNull String program,
               @NonNull String programStage,
               @NonNull String organisationUnit,
               @Nullable Date eventDate,
               @Nullable Date completedDate,
               @Nullable Date dueDate,
               @NonNull State state,
               @NonNull String attributeOptionCombo,
               @Nullable String trackedEntityInstance,
               @NonNull String whereEventUid
    );

    int delete(@NonNull String uid);

    Map<String, List<Event>> queryEventsAttachedToEnrollmentToPost();

    List<Event> querySingleEventsToPost();

    List<Event> querySingleEvents();

    List<Event> queryAll();

    Event queryByUid(String eventUid);

    List<Event> queryOrderedForEnrollmentAndProgramStage(String enrollmentUid, String programStageUid);
}

@@ -1600,191 +1600,64 @@
 ort 
-android.support.annotation.NonNull;%0Aimport android.support.annotation.Nullable;%0A%0Aimport org.hisp.dhis.android.core.common.DeletableStore;%0Aimport org.hisp.dhis.android.core.common.Stat
+org.hisp.dhis.android.core.common.IdentifiableObjectStor
 e;%0Ai
@@ -1717,31 +1717,8 @@
 e;%0A%0A
-import java.util.Date;%0A
 impo
@@ -1799,1756 +1799,56 @@
 nds 
-DeletableStore, StoreWithState %7B%0A    long insert(@NonNull String uid,%0A                @Nullable String enrollmentUid,%0A                @NonNull Date created,%0A                @NonNull Date lastUpdated,%0A                @Nullable String createdAtClient,%0A                @Nullable String lastUpdatedAtClient,%0A                @NonNull EventStatus status,%0A                @Nullable String latitude,%0A                @Nullable String longitude,%0A                @NonNull String program,%0A                @NonNull String programStage,%0A                @NonNull String organisationUnit,%0A                @Nullable Date eventDate,%0A                @Nullable Date completedDate,%0A                @Nullable Date dueDate,%0A                @NonNull State state,%0A                @NonNull String attributeOptionCombo,%0A                @Nullable String trackedEntityInstance%0A    );%0A%0A    int update(@NonNull String uid,%0A               @Nullable String enrollmentUid,%0A               @NonNull Date created,%0A               @NonNull Date lastUpdated,%0A               @Nullable String createdAtClient,%0A               @Nullable String lastUpdatedAtClient,%0A               @NonNull EventStatus eventStatus,%0A               @Nullable String latitude,%0A               @Nullable String longitude,%0A               @NonNull String program,%0A               @NonNull String programStage,%0A               @NonNull String organisationUnit,%0A               @Nullable Date eventDate,%0A               @Nullable Date completedDate,%0A               @Nullable Date dueDate,%0A               @NonNull State state,%0A               @NonNull String attributeOptionCombo,%0A               @Nullable String trackedEntityInstance,%0A               @NonNull String whereEventUid%0A    );%0A%0A    int delete(@NonNull String uid);
+IdentifiableObjectStore%3CEvent%3E, StoreWithState %7B
 %0A%0A  
@@ -1952,32 +1952,32 @@
 ventsToPost();%0A%0A
+
     List%3CEvent%3E 
@@ -2002,77 +2002,8 @@
 );%0A%0A
-    List%3CEvent%3E queryAll();%0A%0A    Event queryByUid(String eventUid);%0A%0A
     

Unify EventStore