package com.conveyal.taui.models;

import com.conveyal.r5.model.json_serialization.BitSetDeserializer;
import com.conveyal.r5.model.json_serialization.BitSetSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.util.BitSet;

/**
 * Convert a line to frequency.
 */
public class ConvertToFrequency extends Modification {
    public String name;

    public String feed;
    public String[] routes;

    public FrequencyEntry[] entries;

    @Override
    public String getType() {
        return "convert-to-frequency";
    }

    public static class FrequencyEntry {
        /** Days of the week on which this service is active, 0 is Monday */
        public boolean monday, tuesday, wednesday, thursday, friday, saturday, sunday;

        /** allow naming entries for organizational purposes */
        public String name;

        /** start time (seconds since GTFS midnight) */
        public int startTime;

        /** end time for frequency-based trips (seconds since GTFS midnight) */
        public int endTime;

        /** headway for frequency-based patterns */
        public int headwaySecs;

        /** trip from which to copy travel times */
        public String sourceTrip;

        /** trips on the selected patterns which could be used as source trips */
        public String[] patternTrips;
    }
}

@@ -488,24 +488,204 @@
 %5B%5D routes;%0A%0A
+    /** Should trips on this route that start outside the days/times specified by frequency entries be retained? */%0A    public boolean retainTripsOutsideFrequencyEntries = false;%0A%0A
     public F
@@ -1376,24 +1376,170 @@
 adwaySecs;%0A%0A
+        /** start times of this trip (seconds since midnight), when non-null scheduled trips will be created */%0A        public int%5B%5D startTimes;%0A%0A
         /** 

add fields to allow adding scheduled trips using adjust frequency modification.