using CSharpFunctionalExtensions;

namespace GeoRitmMover.Mover.Data;
public class Counter : Entity<Guid>
{
	private Counter(Guid id, string name, int lastId)
	{
		Id = id;
		Name = name;
		LastId = lastId;
	}

	public string Name { get; }
	public int LastId { get; }

	public static Counter Create(Guid id, string name, int lastId)
	{
		ArgumentOutOfRangeException.ThrowIfNegative(lastId);

		if (!CounterName.All.Contains(name))
		{
			throw new ArgumentOutOfRangeException(nameof(name));
		}

		return new Counter(id, name, lastId);
	}

	protected Counter() : base() { }
}
