package de.avatic.lcc.util.exception.badrequest;

import de.avatic.lcc.util.exception.base.BadRequestException;

public class NotFoundException extends BadRequestException {

    public NotFoundException(NotFoundType type, String identifier, String value, Exception e) {
        super(type.getIdentifier() + " not found", type.getIdentifier() + " with " + identifier + " " + value + " not found", e);
    }

    public NotFoundException(NotFoundType type, String identifier, String value) {
        super(type.getIdentifier() + " not found", type.getIdentifier() + " with " + identifier + " " + value + " not found");
    }

    public NotFoundException(NotFoundType type, String value) {
        super(type.getIdentifier() + " not found", type.getIdentifier() + " with " + value + " not found");
    }

    public NotFoundException(NotFoundType type, String value, Exception e) {
        super(type.getIdentifier() + " not found", type.getIdentifier() + " with " + value + " not found", e);
    }

    public enum NotFoundType {
        PROPERTY("Property"),
        PROPERTY_SET("Property set"),
        EXPIRED_PROPERTY_SET("Expired property set"),
        MATERIAL("Material"), NODE("Node"),
        COUNTRY("Country"),
        COUNTRY_PROPERTY("Country property"),
        CONTAINER_RATE("Container rate"),
        EXPIRED_VALIDITY_PERIOD("Expired validity period"),
        USER_NODE("User node"),
        USER("User");

        private final String identifier;

        NotFoundType(String identifier) {
            this.identifier = identifier;
        }

        public String getIdentifier() {
            return identifier;
        }
    }

}
