// 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
//
//     https://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.sps.data;

import java.util.ArrayList;
import java.util.List;

/**
 * Contains detection results for a product image.
 */
public class ProductDetectionData {
  private List<String> labels;
  private List<String> logos;
  private List<String> colors;

  public ProductDetectionData(List<String> labels, List<String> logos, List<String> colors) {
    this.labels = new ArrayList<String>(labels);
    this.logos = new ArrayList<String>(logos);
    this.colors = new ArrayList<String>(colors);
  }

  public List<String> getLabels() {
    return labels;
  }

  public List<String> getLogos() {
    return logos;
  }

  public List<String> getColors() {
    return colors;
  }
}

@@ -623,46 +623,83 @@
 ort 
-java.util.ArrayList;%0Aimport java.util.
+com.google.auto.value.AutoValue;%0Aimport com.google.common.collect.Immutable
 List
@@ -760,22 +760,42 @@
 ge.%0A */%0A
-public
+@AutoValue%0Apublic abstract
  class P
@@ -820,131 +820,69 @@
 a %7B%0A
+%0A
   p
-rivate List%3CString%3E labels;%0A  private List%3CString%3E logos;%0A  private List%3CString%3E colors;%0A%0A  public ProductDetectionData(
+ublic static ProductDetectionData create(%0A      Immutable
 List
@@ -898,16 +898,25 @@
 labels, 
+Immutable
 List%3CStr
@@ -927,16 +927,25 @@
  logos, 
+Immutable
 List%3CStr
@@ -967,140 +967,65 @@
     
-this.labels = new ArrayList%3CString%3E(labels);%0A    this.logos = new ArrayList%3CString%3E(logos);%0A    this.colors = new ArrayList%3CString%3E(
+return new AutoValue_ProductDetectionData(labels, logos, 
 colo
@@ -1035,32 +1035,50 @@
 ;%0A  %7D%0A%0A  public 
+abstract Immutable
 List%3CString%3E get
@@ -1089,150 +1089,113 @@
 ls()
- %7B%0A    return labels;%0A  %7D%0A%0A  public List%3CString%3E getLogos() %7B%0A    return logos;%0A  %7D%0A%0A  public List%3CString%3E getColors() %7B%0A    return colors;%0A  %7D
+;%0A  public abstract ImmutableList%3CString%3E getLogos();%0A  public abstract ImmutableList%3CString%3E getColors();
 %0A%7D%0A

Refactor ProductDetectionData: use AutoValue and ImmutableList