package de.avatic.lcc.e2e.testdata;

import java.util.List;

/**
 * Input data for a test case containing all form values to be entered.
 */
public record TestCaseInput(
    String partNumber,
    String supplierName,
    boolean loadFromPrevious,
    Integer hsCode,
    double tariffRate,
    double price,
    double overseaShare,
    boolean fcaFee,
    int length,
    int width,
    int height,
    String dimensionUnit,
    int weight,
    String weightUnit,
    int piecesPerUnit,
    boolean stacked,
    boolean mixed,
    List<DestinationInput> destinations
) {
    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private String partNumber;
        private String supplierName;
        private boolean loadFromPrevious;
        private Integer hsCode;
        private double tariffRate;
        private double price;
        private double overseaShare;
        private boolean fcaFee;
        private int length;
        private int width;
        private int height;
        private String dimensionUnit = "cm";
        private int weight;
        private String weightUnit = "kg";
        private int piecesPerUnit;
        private boolean stacked;
        private boolean mixed;
        private List<DestinationInput> destinations = List.of();

        public Builder partNumber(String partNumber) {
            this.partNumber = partNumber;
            return this;
        }

        public Builder supplierName(String supplierName) {
            this.supplierName = supplierName;
            return this;
        }

        public Builder loadFromPrevious(boolean loadFromPrevious) {
            this.loadFromPrevious = loadFromPrevious;
            return this;
        }

        public Builder hsCode(Integer hsCode) {
            this.hsCode = hsCode;
            return this;
        }

        public Builder tariffRate(double tariffRate) {
            this.tariffRate = tariffRate;
            return this;
        }

        public Builder price(double price) {
            this.price = price;
            return this;
        }

        public Builder overseaShare(double overseaShare) {
            this.overseaShare = overseaShare;
            return this;
        }

        public Builder fcaFee(boolean fcaFee) {
            this.fcaFee = fcaFee;
            return this;
        }

        public Builder length(int length) {
            this.length = length;
            return this;
        }

        public Builder width(int width) {
            this.width = width;
            return this;
        }

        public Builder height(int height) {
            this.height = height;
            return this;
        }

        public Builder dimensionUnit(String dimensionUnit) {
            this.dimensionUnit = dimensionUnit;
            return this;
        }

        public Builder weight(int weight) {
            this.weight = weight;
            return this;
        }

        public Builder weightUnit(String weightUnit) {
            this.weightUnit = weightUnit;
            return this;
        }

        public Builder piecesPerUnit(int piecesPerUnit) {
            this.piecesPerUnit = piecesPerUnit;
            return this;
        }

        public Builder stacked(boolean stacked) {
            this.stacked = stacked;
            return this;
        }

        public Builder mixed(boolean mixed) {
            this.mixed = mixed;
            return this;
        }

        public Builder destinations(List<DestinationInput> destinations) {
            this.destinations = destinations;
            return this;
        }

        public TestCaseInput build() {
            return new TestCaseInput(
                partNumber, supplierName, loadFromPrevious, hsCode, tariffRate, price,
                overseaShare, fcaFee, length, width, height, dimensionUnit, weight,
                weightUnit, piecesPerUnit, stacked, mixed, destinations
            );
        }
    }
}
