// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.dicomwebfuse.parser;

import com.beust.jcommander.Parameter;
import com.beust.jcommander.converters.BooleanConverter;
import com.beust.jcommander.converters.LongConverter;
import com.beust.jcommander.converters.PathConverter;
import com.google.dicomwebfuse.entities.CloudConf;
import com.google.dicomwebfuse.entities.cache.CacheTime;
import java.nio.file.Path;

public class Arguments {

  @Parameter(
      names = {"--datasetAddr", "-a"},
      description = "Web address to the Dataset. " +
          "Example: https://healthcare.googleapis.com/STAGE/projects/PROJECT/locations/" +
          "LOCATION/datasets/DATASET",
      required = true,
      converter = CloudConfigurationConverter.class
  )
  public CloudConf cloudConf;

  @Parameter(
      names = {"--mountPath", "-p"},
      description = "Path to mount the Dataset. Example on Linux: /home/user/fuse-mount-folder. "
          + "Example on macOS: /Users/user/fuse-mount-folder "
          + "Example on Windows: J:\\",
      required = true,
      converter = PathConverter.class
  )
  public Path mountPath;

  @Parameter(
      names = {"--cacheTime", "-t"},
      description = "Each value in this option is measured in seconds. For optimization of the "
          + "DICOMFuse, caching DICOM Store folders, Study folders, Series folders, list of "
          + "Instances(first parameter in option), and opened Instances files(second parameter) "
          + "were included. Caching opened Instances files are performed to the temporary folder in "
          + "user space on the disk. Caching other objects are performed to the RAM. After closing "
          + "DICOMFuse or, if cached files out of date, they will be deleted. If you delete an "
          + "Instance file locally, the cache will be updated. If you upload an Instance file, the "
          + "cache will be updated.",
      converter = CacheTimeConverter.class
  )
  public CacheTime cacheTime = new CacheTime(60, 300);

  @Parameter(
      names = {"--cacheSize", "-s"},
      description = "Maximum cache size in megabytes for cached instances. "
          + "The maximum file size that can be download/upload is cacheSize / 4",
      converter = LongConverter.class
  )
  public long cacheSize = 10000;

  @Parameter(
      names = {"--enableDeletion", "-d"},
      description = "Some programs can delete files and you can do this, including accidental "
          + "deletion. If you don't want to delete files, you can set --enableDeletion=false",
      converter = BooleanConverter.class
  )
  public boolean enableDeletion = true;

  @Parameter(
      names = {"--keyFile", "-k"},
      description = "Path to the account service key",
      converter = PathConverter.class
  )
  public Path keyPath;

  @Parameter(
      names = {"--help", "-h"},
      help = true,
      description = "Print help"
  )
  public boolean help = false;
}
@@ -1153,13 +1153,15 @@
 com/
-STAGE
+v1beta1
 /pro
@@ -1806,19 +1806,18 @@
 ds. 
-For
+To
  optimiz
 atio
@@ -1816,16 +1816,20 @@
 imiz
-ation of
+e DICOMFuse,
  the
@@ -1848,34 +1848,47 @@
  + %22
-DICOMFuse,
+following resources are
  cach
-ing
+ed:
  DICOM 
-S
+s
 tore
@@ -1931,16 +1931,8 @@
 ers,
- list of
  %22%0A 
@@ -1935,32 +1935,40 @@
  %22%0A          + %22
+list of 
 Instances(first 
@@ -1960,16 +1960,17 @@
 nstances
+ 
 (first p
@@ -2020,26 +2020,16 @@
 iles
+ 
 (second
- parameter)
  %22%0A 
@@ -2044,32 +2044,21 @@
  + %22
-were included. Caching o
+parameter). O
 pene
@@ -2063,25 +2063,24 @@
 ned Instance
-s
  files are p
@@ -2074,31 +2074,28 @@
 e files are 
-perform
+cach
 ed to the te
@@ -2116,56 +2116,48 @@
  in 
-%22%0A          + %22user space on the disk. Caching o
+the user space %22%0A          + %22on disk. O
 ther
@@ -2173,43 +2173,64 @@
 are 
-perform
+cach
 ed to 
-the 
 RAM. 
-After
+Cached files will be deleted if you
  clos
-ing
+e
  %22%0A 
@@ -2257,13 +2257,16 @@
 e or
-,
  if 
+the 
 cach
@@ -2274,16 +2274,23 @@
 d files 
+become 
 out of d
@@ -2296,30 +2296,8 @@
 date
-, they will be deleted
 . If
@@ -2311,16 +2311,30 @@
 lete an 
+Instance file 
 %22%0A      
@@ -2340,30 +2340,16 @@
      + %22
-Instance file 
 locally,
@@ -2408,24 +2408,38 @@
 e file, the 
+cache will be 
 %22%0A          
@@ -2441,30 +2441,16 @@
      + %22
-cache will be 
 updated.
@@ -2742,15 +2742,19 @@
 load
+ed
 /upload
+ed
  is 
@@ -2961,69 +2961,99 @@
 and 
-you can do this, including accidental %22%0A          + %22deletion
+deletion can also be done manually. %22%0A          + %22Sometimes accidental deletions can occur
 . If
@@ -3093,16 +3093,31 @@
 you can 
+%22%0A          + %22
 set --en

update arguments description