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

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

import java.util.ArrayList;

public class PartialBlurTask extends ImageTransformTask {

    // Constructor made private because this task cannot be used with default options
    private PartialBlurTask() {
        super("partial_pixelate");
    }

    public static class Builder {
        private PartialBlurTask partialBlurTask;
        private ArrayList<Area> objects;
        
        public Builder() {
            this.partialBlurTask = new PartialBlurTask();
            objects = new ArrayList<>();
        }

        public Builder amount(double amount) {
            partialBlurTask.addOption("amount", amount);
            return this;
        }

        public Builder blur(double blur) {
            partialBlurTask.addOption("blur", blur);
            return this;
        }

        public Builder type(String type) {
            partialBlurTask.addOption("type", type);
            return this;
        }

        public Builder addArea(int x, int y, int width, int height) {
            objects.add(new Area(x, y, width, height));
            return this;
        }

        public PartialBlurTask build() {
            partialBlurTask.addOption("objects", objects);
            return partialBlurTask;
        }
    }

    private static class Area {
        int x;
        int y;
        int width;
        int height;

        public Area(int x, int y, int width, int height) {
            this.x = x;
            this.y = y;
            this.width = width;
            this.height = height;
        }

        @Override
        public String toString() {
            return "[" + x + "," + y + "," + width + "," + height + "]";
        }
    }
}

@@ -1391,17 +1391,23 @@
     int 
-x
+originX
 ;%0A      
@@ -1412,17 +1412,23 @@
     int 
-y
+originY
 ;%0A      
@@ -1481,32 +1481,44 @@
 ic Area(int 
-x, int y
+originX, int originY
 , int width,
@@ -1553,13 +1553,25 @@
 his.
-x = x
+originX = originX
 ;%0A  
@@ -1589,13 +1589,25 @@
 his.
-y = y
+originY = originY
 ;%0A  
@@ -1759,17 +1759,23 @@
 n %22%5B%22 + 
-x
+originX
  + %22,%22 +
@@ -1775,17 +1775,23 @@
 + %22,%22 + 
-y
+originY
  + %22,%22 +

Fix linter warnings for PartialBlurTask