package project.ilyagorban.model;

public enum Rank {
	WHITE_KING(100, "k", Owner.WHITE, "♔"), WHITE_QUEEN(4, "q", Owner.WHITE,
			"♕"), WHITE_ROOK(3, "r", Owner.WHITE, "♖"), WHITE_BISHOP(2, "b",
			Owner.WHITE, "♗"), WHITE_KNIGHT(2, "n", Owner.WHITE, "♘"), WHITE_PAWN(
			1, "p", Owner.WHITE, "♙"), BLACK_KING(100, "k", Owner.BLACK, "♚"), BLACK_QUEEN(
			4, "q", Owner.BLACK, "♛"), BLACK_ROOK(3, "r", Owner.BLACK, "♜"), BLACK_BISHOP(
			2, "b", Owner.BLACK, "♝"), BLACK_KNIGHT(2, "n", Owner.BLACK, "♞"), BLACK_PAWN(
			1, "p", Owner.BLACK, "♟");

	// ♔♕♖♗♘♙♚♛♜♝♞♟

	public static Rank getFigure(String s, Owner o) {
		for (Rank r : Rank.values()) {
			if (r.index.equals(s) && r.owner == o)
				return r;
		}
		return null;
	}

	private String index;
	private int importance;
	private String picture;
	private Owner owner;

	private Rank(int i, String s, Owner o, String c) {
		this.importance = i;
		this.owner = o;
		this.picture = c;
		this.index = s;
	}

	public int getImportance() {
		return importance;
	}

	public Owner getOwner() {
		return owner;
	}

	public String getPicture() {
		return picture;
	}

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

@@ -47,17 +47,20 @@
  Rank %7B%0A
-%09
+    
 WHITE_KI
@@ -125,18 +125,20 @@
 WHITE,%0A%09
-%09%09
+    
 %22%E2%99%95%22), WH
@@ -195,18 +195,20 @@
 , %22b%22,%0A%09
-%09%09
+    
 Owner.WH
@@ -263,34 +263,36 @@
 ), WHITE_PAWN(%0A%09
-%09%09
+    
 1, %22p%22, Owner.WH
@@ -356,18 +356,20 @@
 QUEEN(%0A%09
-%09%09
+    
 4, %22q%22, 
@@ -440,18 +440,20 @@
 ISHOP(%0A%09
-%09%09
+    
 2, %22b%22, 
@@ -524,18 +524,20 @@
 _PAWN(%0A%09
-%09%09
+    
 1, %22p%22, 
@@ -556,17 +556,20 @@
  %22%E2%99%9F%22);%0A%0A
-%09
+    
 // %E2%99%94%E2%99%95%E2%99%96%E2%99%97%E2%99%98
@@ -577,17 +577,20 @@
 %E2%99%9A%E2%99%9B%E2%99%9C%E2%99%9D%E2%99%9E%E2%99%9F%0A%0A
-%09
+    
 public s
@@ -607,14 +607,12 @@
  get
-Figure
+Rank
 (Str
@@ -629,17 +629,16 @@
 er o) %7B%0A
-%09
 %09for (Ra
@@ -662,18 +662,20 @@
 s()) %7B%0A%09
-%09%09
+    
 if (r.in
@@ -705,18 +705,16 @@
 r == o)%0A
-%09%09
 %09%09return
@@ -721,13 +721,11 @@
  r;%0A
-%09
 %09%7D%0A
-%09
 %09ret
@@ -734,21 +734,27 @@
 n null;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 private 
@@ -767,17 +767,20 @@
  index;%0A
-%09
+    
 private 
@@ -795,17 +795,20 @@
 rtance;%0A
-%09
+    
 private 
@@ -823,17 +823,20 @@
 icture;%0A
-%09
+    
 private 
@@ -849,17 +849,20 @@
 owner;%0A%0A
-%09
+    
 private 
@@ -904,17 +904,16 @@
 ng c) %7B%0A
-%09
 %09this.im
@@ -926,17 +926,16 @@
 ce = i;%0A
-%09
 %09this.ow
@@ -943,17 +943,16 @@
 er = o;%0A
-%09
 %09this.pi
@@ -962,17 +962,16 @@
 re = c;%0A
-%09
 %09this.in
@@ -979,21 +979,27 @@
 ex = s;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 public i
@@ -1015,25 +1015,24 @@
 ortance() %7B%0A
-%09
 %09return impo
@@ -1039,21 +1039,27 @@
 rtance;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 public O
@@ -1072,25 +1072,24 @@
 etOwner() %7B%0A
-%09
 %09return owne
@@ -1091,21 +1091,27 @@
  owner;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 public S
@@ -1127,25 +1127,24 @@
 Picture() %7B%0A
-%09
 %09return pict
@@ -1152,13 +1152,19 @@
 re;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 @Ove
@@ -1169,17 +1169,20 @@
 verride%0A
-%09
+    
 public S
@@ -1200,17 +1200,16 @@
 ing() %7B%0A
-%09
 %09return 
@@ -1217,13 +1217,16 @@
 icture;%0A
-%09
+    
 %7D%0A%7D%0A

refactor Rank