// Path: scheduled-actions-core/src/main/java/com/netflix/scheduledactions/Context.java
// public class Context {
//     private String actionInstanceId;
//     private final String name;
//     private final String group;
//     private final Map<String, String> parameters;
// 
//     @JsonCreator
//     public Context(@JsonProperty("actionInstanceId") String actionInstanceId,
//                    @JsonProperty("name") String name,
//                    @JsonProperty("group") String group,
//                    @JsonProperty("parameters") Map<String, String> parameters) {
//         this.actionInstanceId = actionInstanceId;
//         this.name = name;
//         this.group = group;
//         this.parameters = parameters;
//     }
// 
//     public void setActionInstanceId(String actionInstanceId) {
//         this.actionInstanceId = actionInstanceId;
//     }
// 
//     public String getActionInstanceId() {
//       return actionInstanceId;
//     }
// 
//     public String getName() {
//         return name;
//       }
// 
//     public String getGroup() {
//       return group;
//     }
// 
//     public Map<String, String> getParameters() {
//       return parameters;
//     }
// 
//     @Override
//     public String toString() {
//         return String.format(
//             "Context: (actionInstance: %s, name: %s, group: %s, parameters: %s)", actionInstanceId, name, group, parameters
//         );
//     }
// }


import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.netflix.fenzo.triggers.TriggerUtils;
import com.netflix.scheduledactions.Context;
import rx.functions.Action1;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
    /**
     * Creates an interval trigger that starts immediately and repeats indefinitely
     */
    public IntervalTrigger(int interval, TimeUnit intervalUnit) {
        this(interval, intervalUnit, -1, null);
    }

    /**
     * Creates an interval trigger based on the given parameters
     */
    public IntervalTrigger(int interval, TimeUnit intervalUnit, int repeatCount, Date startAt) {
        if (interval <= 0) {
            throw new IllegalArgumentException(String.format("Invalid interval %s specified for the IntervalTrigger", interval));
        }
        if (startAt == null) {
            startAt = new Date();
        }
        DateFormat dateFormat = new SimpleDateFormat(ISO_8601_DATE_FORMAT);
        this.iso8601Interval = String.format(
            "%s/%s%s%s", dateFormat.format(startAt), ISO_8601_TIME_PREFIX, interval, intervalUnit.getTimeUnitSuffix()
        );
        this.repeatCount = repeatCount;
    }

    @Override
    public void validate() throws IllegalArgumentException {
        TriggerUtils.validateISO8601Interval(iso8601Interval);
    }

    @Override
// Path: scheduled-actions-core/src/main/java/com/netflix/scheduledactions/Context.java
// public class Context {
//     private String actionInstanceId;
//     private final String name;
//     private final String group;
//     private final Map<String, String> parameters;
// 
//     @JsonCreator
//     public Context(@JsonProperty("actionInstanceId") String actionInstanceId,
//                    @JsonProperty("name") String name,
//                    @JsonProperty("group") String group,
//                    @JsonProperty("parameters") Map<String, String> parameters) {
//         this.actionInstanceId = actionInstanceId;
//         this.name = name;
//         this.group = group;
//         this.parameters = parameters;
//     }
// 
//     public void setActionInstanceId(String actionInstanceId) {
//         this.actionInstanceId = actionInstanceId;
//     }
// 
//     public String getActionInstanceId() {
//       return actionInstanceId;
//     }
// 
//     public String getName() {
//         return name;
//       }
// 
//     public String getGroup() {
//       return group;
//     }
// 
//     public Map<String, String> getParameters() {
//       return parameters;
//     }
// 
//     @Override
//     public String toString() {
//         return String.format(
//             "Context: (actionInstance: %s, name: %s, group: %s, parameters: %s)", actionInstanceId, name, group, parameters
//         );
//     }
// }


// Path: scheduled-actions-core/src/main/java/com/netflix/scheduledactions/triggers/IntervalTrigger.java
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.netflix.fenzo.triggers.TriggerUtils;
import com.netflix.scheduledactions.Context;
import rx.functions.Action1;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

    /**
     * Creates an interval trigger that starts immediately and repeats indefinitely
     */
    public IntervalTrigger(int interval, TimeUnit intervalUnit) {
        this(interval, intervalUnit, -1, null);
    }

    /**
     * Creates an interval trigger based on the given parameters
     */
    public IntervalTrigger(int interval, TimeUnit intervalUnit, int repeatCount, Date startAt) {
        if (interval <= 0) {
            throw new IllegalArgumentException(String.format("Invalid interval %s specified for the IntervalTrigger", interval));
        }
        if (startAt == null) {
            startAt = new Date();
        }
        DateFormat dateFormat = new SimpleDateFormat(ISO_8601_DATE_FORMAT);
        this.iso8601Interval = String.format(
            "%s/%s%s%s", dateFormat.format(startAt), ISO_8601_TIME_PREFIX, interval, intervalUnit.getTimeUnitSuffix()
        );
        this.repeatCount = repeatCount;
    }

    @Override
    public void validate() throws IllegalArgumentException {
        TriggerUtils.validateISO8601Interval(iso8601Interval);
    }

    @Override
    public com.netflix.fenzo.triggers.Trigger<Context> createFenzoTrigger(Context context,