/*-
 *  Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
 * 
 *  This file is part of CityDoctor2.
 *
 *  CityDoctor2 is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  CityDoctor2 is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with CityDoctor2.  If not, see <https://www.gnu.org/licenses/>.
 */
package de.hft.stuttgart.citydoctor2.check;

import java.io.Serializable;

/**
 * The error ids of all checks and their respective name, which is used in
 * reports and GUI
 * 
 * @author Matthias Betz
 *
 */
public class ErrorId implements Serializable {
	
	private static final long serialVersionUID = -2598466667746276560L;
	
	public static final ErrorId DEPENDENCIES_NOT_MET = new ErrorId("Dependencies_not_met");
	public static final ErrorId UNKNOWN_ERROR = new ErrorId("Unknown_error");
	public static final ErrorId GE_R_NOT_CLOSED = new ErrorId("GE_R_NOT_CLOSED");
	public static final ErrorId GE_S_MULTIPLE_CONNECTED_COMPONENTS = new ErrorId("GE_S_MULTIPLE_CONNECTED_COMPONENTS");
	public static final ErrorId GE_R_CONSECUTIVE_POINTS_SAME = new ErrorId("GE_R_CONSECUTIVE_POINTS_SAME");
	public static final ErrorId GE_R_SELF_INTERSECTION = new ErrorId("GE_R_SELF_INTERSECTION");
	public static final ErrorId GE_S_POLYGON_WRONG_ORIENTATION = new ErrorId("GE_S_POLYGON_WRONG_ORIENTATION");
	public static final ErrorId GE_S_ALL_POLYGONS_WRONG_ORIENTATION = new ErrorId(
			"GE_S_ALL_POLYGONS_WRONG_ORIENTATION");
	public static final ErrorId GE_P_HOLE_OUTSIDE = new ErrorId("GE_P_HOLE_OUTSIDE");
	public static final ErrorId GE_P_INTERIOR_DISCONNECTED = new ErrorId("GE_P_INTERIOR_DISCONNECTED");
	public static final ErrorId GE_S_NON_MANIFOLD_VERTEX = new ErrorId("GE_S_NON_MANIFOLD_VERTEX");
	public static final ErrorId GE_P_INNER_RINGS_NESTED = new ErrorId("GE_P_INNER_RINGS_NESTED");
	public static final ErrorId GE_R_NULL_AREA = new ErrorId("GE_R_NULL_AREA");
	public static final ErrorId GE_R_TOO_FEW_POINTS = new ErrorId("GE_R_TOO_FEW_POINTS");
	public static final ErrorId GE_S_NON_MANIFOLD_EDGE = new ErrorId("GE_S_NON_MANIFOLD_EDGE");
	public static final ErrorId GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION = new ErrorId(
			"GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION");
	public static final ErrorId GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE = new ErrorId(
			"GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE");
	public static final ErrorId GE_P_INTERSECTING_RINGS = new ErrorId("GE_P_INTERSECTING_RINGS");
	public static final ErrorId GE_S_SELF_INTERSECTION = new ErrorId("GE_S_SELF_INTERSECTION");
	public static final ErrorId GE_P_ORIENTATION_RINGS_SAME = new ErrorId("GE_P_ORIENTATION_RINGS_SAME");
	public static final ErrorId GE_S_NOT_CLOSED = new ErrorId("GE_S_NOT_CLOSED");
	public static final ErrorId GE_S_TOO_FEW_POLYGONS = new ErrorId("GE_S_TOO_FEW_POLYGONS");
	public static final ErrorId SEM_F_MISSING_ID = new ErrorId("SEM_F_MISSING_ID");
	public static final ErrorId SEM_BS_NOT_CEILING = new ErrorId("SEM_BS_NOT_CEILING");
	public static final ErrorId SEM_BS_NOT_WALL = new ErrorId("SEM_BS_NOT_WALL");
	public static final ErrorId SEM_BS_NOT_FLOOR = new ErrorId("SEM_BS_NOT_FLOOR");
	public static final ErrorId SEM_BS_NOT_GROUND = new ErrorId("SEM_BS_NOT_GROUND");
	public static final ErrorId SEM_SCHEMATRON_ERROR = new ErrorId("SEM_SCHEMATRON_ERROR");
	public static final ErrorId SEM_BS_UNFRAGMENTED = new ErrorId("SEM_BS_UNFRAGMENTED");
	public static final ErrorId GE_P_TINY_EDGE = new ErrorId("GE_P_TINY_EDGE");

	private String name;

	public ErrorId(String name) {
		this.name = name;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ErrorId other = (ErrorId) obj;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return name;
	}

}
