package net.ranides.assira.ui.model;

import lombok.Data;

@Data
public class CssBorderSize {

    public static final CssBorderSize NONE = new CssBorderSize(1, 1, 1, 1);

    public static final CssBorderSize SINGLE = new CssBorderSize(1, 1, 1, 1);

    public static final CssBorderSize DOUBLE = new CssBorderSize(2, 2, 2, 2);

    private final int top;
    private final int left;
    private final int bottom;
    private final int right;

    public boolean isSimple() {
        return top == left && top == bottom && top == right;
    }

    public int getSimpleSize() {
        if (!isSimple()) {
            throw new IllegalArgumentException("This type of border requires simple border size");
        }
        return left;
    }

    public static CssBorderSize of(int size) {
        return new CssBorderSize(size, size, size, size);
    }

    public static CssBorderSize of(int vertical, int horizontal) {
        return new CssBorderSize(vertical, horizontal, vertical, horizontal);
    }

    public static CssBorderSize of(int top, int left, int bottom, int right) {
        return new CssBorderSize(top, left, bottom, right);
    }
}
