package org.sagebionetworks.bridge.models.upload;

import java.util.List;

import org.joda.time.LocalDate;

/** Metadata for Bridge uploads. */
public interface Upload {
    /**
     * If the upload is in a state where calling uploadComplete() and kicking off validation is a valid thing to do,
     * then this method will return true. Otherwise, this method will return false.
     */
    boolean canBeValidated();

    /** Name of the file to upload. */
    String getFilename();

    /** Health code of the user from which this upload originates from. */
    String getHealthCode();

    /**
     * S3 object ID (key name). This is generated by Bridge to ensure no filename collisions and to ensure that we
     * don't get S3 hotspots from poorly distributed names.
     */
    String getObjectId();

    /** Represents upload status, such as requested, validation in progress, validation failed, or succeeded. */
    UploadStatus getStatus();

    /**
     * Calendar date the file was uploaded (specifically, the uploadComplete() call. Date is determined using Pacific
     * local time.
     */
    LocalDate getUploadDate();

    /** Upload ID. This is the key in the Dynamo DB table that uniquely identifies this upload. */
    String getUploadId();

    /** List of validation messages, generally contains error messages. */
    List<String> getValidationMessageList();
}

@@ -947,24 +947,35 @@
 );%0A%0A    /**%0A
+     * %3Cp%3E%0A
      * Calen
@@ -1046,16 +1046,35 @@
 () call.
+%0A     * %3C/p%3E%0A     *
  Date is
@@ -1098,23 +1098,16 @@
  Pacific
-%0A     *
  local t
@@ -1110,16 +1110,374 @@
 al time.
+ Pacific local time was chosen because currently, all studies are%0A     * done in the US, so if we partitioned based on date using UTC, we'd get a cut-off in the middle of the afternoon,%0A     * likely in the middle of peak uploads. In the future, if we have studies outside of the US, the upload date%0A     * timezone will be configurable per study.%0A     * %3Cp%3E
 %0A     */
@@ -1642,16 +1642,23 @@
 %0A    /**
+%0A     *
  List of
@@ -1713,16 +1713,292 @@
 essages.
+ Since a single upload file may fail validation%0A     * in multiple ways, Bridge server will attempt to return all messages to the user. For example, the upload file%0A     * might be unencrypted, uncompressed, and it might not fit any of the expected schemas for the study.%0A    
  */%0A    

add comments for CR responses