// Path: buildSrc/src/main/java/org/jazzcommunity/development/library/DetectOperatingSystem.java
// public class DetectOperatingSystem {
//   public static boolean isWindows() {
//     return OperatingSystem.current().isWindows();
//   }
// 
//   public static boolean isLinux() {
//     return OperatingSystem.current().isLinux();
//   }
// }
// 
// Path: buildSrc/src/main/java/org/jazzcommunity/development/library/file/FileResolver.java
// public final class FileResolver {
//   private static final Logger logger = LoggerFactory.getLogger("FileResolver");
// 
//   private FileResolver() {}
// 
//   public static Stream<Path> findInDirectory(Path directory, String endsWith) {
//     try {
//       return Files.find(directory, 1, (p, b) -> p.getFileName().toString().endsWith(endsWith));
//     } catch (IOException e) {
//       if (logger.isDebugEnabled()) {
//         e.printStackTrace();
//       }
//       logger.info(
//           "File ending with '{}' in '{}' not found. Ignoring this entry.", directory, endsWith);
//       return null;
//     }
//   }
// }


import java.io.File;
import java.nio.file.Path;
import java.util.stream.Stream;
import org.jazzcommunity.development.library.DetectOperatingSystem;
import org.jazzcommunity.development.library.file.FileResolver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
package org.jazzcommunity.development.library.config.plugin;


class UiEntry implements IniEntry {

  private final Logger logger = LoggerFactory.getLogger(this.getClass());
  protected final File directory;

  public UiEntry(File directory) {
    this.directory = directory;
  }

  @Override
  public String getIniLine() {
    // TODO: duplicated code
    String formatted = directory.getPath();

    if (DetectOperatingSystem.isWindows()) {
      formatted = formatted.replaceAll("\\\\", "/");
      formatted = formatted.replaceAll(":", "\\\\:");
    }

    return String.format("reference\\:file\\:%s@start", formatted);
  }

  @Override
  public String getPropertiesLine() {
    // UI plugins don't require an entry in the .properties file.
    return "";
  }

  @Override
  public boolean needsPropertyEntry() {
    return false;
  }

  @Override
  public Stream<Path> getZip() {
// Path: buildSrc/src/main/java/org/jazzcommunity/development/library/DetectOperatingSystem.java
// public class DetectOperatingSystem {
//   public static boolean isWindows() {
//     return OperatingSystem.current().isWindows();
//   }
// 
//   public static boolean isLinux() {
//     return OperatingSystem.current().isLinux();
//   }
// }
// 
// Path: buildSrc/src/main/java/org/jazzcommunity/development/library/file/FileResolver.java
// public final class FileResolver {
//   private static final Logger logger = LoggerFactory.getLogger("FileResolver");
// 
//   private FileResolver() {}
// 
//   public static Stream<Path> findInDirectory(Path directory, String endsWith) {
//     try {
//       return Files.find(directory, 1, (p, b) -> p.getFileName().toString().endsWith(endsWith));
//     } catch (IOException e) {
//       if (logger.isDebugEnabled()) {
//         e.printStackTrace();
//       }
//       logger.info(
//           "File ending with '{}' in '{}' not found. Ignoring this entry.", directory, endsWith);
//       return null;
//     }
//   }
// }


// Path: buildSrc/src/main/java/org/jazzcommunity/development/library/config/plugin/UiEntry.java
import java.io.File;
import java.nio.file.Path;
import java.util.stream.Stream;
import org.jazzcommunity.development.library.DetectOperatingSystem;
import org.jazzcommunity.development.library.file.FileResolver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

package org.jazzcommunity.development.library.config.plugin;


class UiEntry implements IniEntry {

  private final Logger logger = LoggerFactory.getLogger(this.getClass());
  protected final File directory;

  public UiEntry(File directory) {
    this.directory = directory;
  }

  @Override
  public String getIniLine() {
    // TODO: duplicated code
    String formatted = directory.getPath();

    if (DetectOperatingSystem.isWindows()) {
      formatted = formatted.replaceAll("\\\\", "/");
      formatted = formatted.replaceAll(":", "\\\\:");
    }

    return String.format("reference\\:file\\:%s@start", formatted);
  }

  @Override
  public String getPropertiesLine() {
    // UI plugins don't require an entry in the .properties file.
    return "";
  }

  @Override
  public boolean needsPropertyEntry() {
    return false;
  }

  @Override
  public Stream<Path> getZip() {
    return FileResolver.findInDirectory(directory.toPath(), ".zip");