class LayerDefinitionParser implements CommandLine.ITypeConverter<FileEntriesLayer> {

  @VisibleForTesting
  static ModificationTimeProvider parseTimestampsDirective(String directive) {
    if ("actual".equals(directive)) {
      return new ActualTimestampProvider();
    }

    // treat as seconds since epoch
    if (directive.matches("\\d+")) {
      long secondsSinceEpoch = Long.parseLong(directive);
      return new FixedTimestampProvider(Instant.ofEpochSecond(secondsSinceEpoch));
    }
    return new FixedTimestampProvider(
        DateTimeFormatter.ISO_DATE_TIME.parse(directive, Instant::from));
  }

}