/*
 * Copyright 2016 Cionik
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.cionik.aguit.model;

public enum Direction {

	/**
	 * Up, with 0 horizontal and -1 vertical.
	 */
	NORTH(0, -1),

	NORTHEAST(1, -1),

	/**
	 * Right, with 1 horizontal and 0 vertical.
	 */
	EAST(1, 0),

	SOUTHEAST(1, 1),

	/**
	 * Down, with 0 horizontal and 1 vertical.
	 */
	SOUTH(0, 1),

	SOUTHWEST(-1, 1),

	/**
	 * Left, with -1 horizontal and 0 vertical.
	 */
	WEST(-1, 0),

	NORTHWEST(-1, -1),

	/**
	 * Center, with 0 horizontal and vertical.
	 */
	CENTER(0, 0);

	private final int horizontal;
	private final int vertical;

	private Direction(int horizontal, int vertical) {
		this.horizontal = horizontal;
		this.vertical = vertical;
	}

	/**
	 * Gets the horizontal offset for this direction, either -1, 0, or 1.
	 * 
	 * @return the horizontal offset
	 */
	public int getHorizontalOffset() {
		return horizontal;
	}

	/**
	 * Gets the vertical offset for this direction, either -1, 0, or 1.
	 * 
	 * @return the vertical offset
	 */
	public int getVerticalOffset() {
		return vertical;
	}
	
	@Override
	public String toString() {
		return "Direction[" + name() +":" + "horizontalOffset:" + horizontal + ", verticalOffset:" + vertical + "]";
	}

}
