using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace skyscraper8.Skyscraper.Security.AccessControl
{
	internal class BissKey
	{
		public BissKey(uint bissCoordinate, byte[] keyData)
		{
			Coordinate = bissCoordinate;
			Key = keyData;
		}

		public byte[] Key { get; set; }

		public uint Coordinate { get; set; }

		protected bool Equals(BissKey other)
		{
			return Coordinate == other.Coordinate;
		}

		public override bool Equals(object? obj)
		{
			if (ReferenceEquals(null, obj)) 
				return false;
			if (ReferenceEquals(this, obj)) 
				return true;
			if (obj.GetType() != this.GetType()) 
				return false;
			return Equals((BissKey)obj);
		}

		public override int GetHashCode()
		{
			return (int)Coordinate;
		}

		public override string ToString()
		{
			return String.Format("F {0:X8} 00000000 {1}", Coordinate, BitConverter.ToString(Key).Replace("-", ""));
		}
	}
}
