package com.lemenzo.gallery.editor;

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

/** Immutable editor snapshot used by undo/redo. */
public final class EditState {
    public final ArrayList<Integer> operations;
    public final int cropMode;
    public final float cropLeft, cropTop, cropRight, cropBottom;
    public final float brightness, contrast, saturation, warmth, exposure, tint;
    public final float highlights, shadows, sharpness;
    public final float straighten, perspectiveX, perspectiveY, vignette;
    public final int filter;
    public final ArrayList<EditorAnnotation> annotations;

    public EditState(List<Integer> operations, int cropMode,
            float cropLeft, float cropTop, float cropRight, float cropBottom,
            float brightness, float contrast, float saturation, float warmth,
            float exposure, float tint, float highlights, float shadows, float sharpness,
            float straighten, float perspectiveX, float perspectiveY, float vignette,
            int filter, List<EditorAnnotation> annotations) {
        this.operations = new ArrayList<>(operations);
        this.cropMode = cropMode;
        this.cropLeft = cropLeft;
        this.cropTop = cropTop;
        this.cropRight = cropRight;
        this.cropBottom = cropBottom;
        this.brightness = brightness;
        this.contrast = contrast;
        this.saturation = saturation;
        this.warmth = warmth;
        this.exposure = exposure;
        this.tint = tint;
        this.highlights = highlights;
        this.shadows = shadows;
        this.sharpness = sharpness;
        this.straighten = straighten;
        this.perspectiveX = perspectiveX;
        this.perspectiveY = perspectiveY;
        this.vignette = vignette;
        this.filter = filter;
        this.annotations = new ArrayList<>();
        if (annotations != null) for (EditorAnnotation a : annotations) this.annotations.add(new EditorAnnotation(a));
    }
}
