package com.filestack.model.transform.tasks.faces;

import com.filestack.model.transform.base.ImageTransformTask;

public class CropFacesTask extends ImageTransformTask {

    // Constructor made private because this task cannot be used with default options
    private CropFacesTask() {
        super("crop_faces");
    }
    
    public static class Builder {
        private CropFacesTask cropFacesTask;
        
        public Builder() {
            this.cropFacesTask = new CropFacesTask();
        }

        public Builder mode(String mode) {
            cropFacesTask.addOption("mode", mode);
            return this;
        }

        public Builder width(int width) {
            cropFacesTask.addOption("width", width);
            return this;
        }

        public Builder height(int height) {
            cropFacesTask.addOption("height", height);
            return this;
        }

        public Builder faces(int... faces) {
            if (faces.length == 1) {
                cropFacesTask.addOption("faces", faces[0]);
                return this;
            }

            Integer[] objectArray = new Integer[faces.length];
            for (int i = 0; i < faces.length; i++)
                objectArray[i] = faces[i];
            cropFacesTask.addOption("faces", objectArray);
            return this;
        }

        // For "all" value
        public Builder faces(String faces) {
            cropFacesTask.addOption("faces", faces);
            return this;
        }

        public Builder buffer(int buffer) {
            cropFacesTask.addOption("buffer", buffer);
            return this;
        }

        public CropFacesTask build() {
            return cropFacesTask;
        }
    }
}

@@ -889,32 +889,247 @@
 his;%0A        %7D%0A%0A
+        /**%0A         * Sets which faces to crop.%0A         * Face numbers correspond to the order in which they appear in an image.%0A         *%0A         * @param faces one or more integers (faces) to crop%0A         */%0A
         public B
@@ -1149,32 +1149,32 @@
 int... faces) %7B%0A
-
             if (
@@ -1411,16 +1411,18 @@
 th; i++)
+ %7B
 %0A       
@@ -1457,16 +1457,30 @@
 ces%5Bi%5D;%0A
+            %7D%0A
         
@@ -1579,25 +1579,54 @@
    /
-/ For %22all%22 value
+** Allows setting %22all%22 for face selection. */
 %0A   

Fix linter warnings for CropFacesTask