using Monitoring.Core.Domain.AssetManagement;

namespace Monitoring.Core.Domain.CameraManagement;

/// <summary>
/// Камера.
/// </summary>
public class Camera
{
	/// <summary>
	/// ИД.
	/// </summary>
	public CameraId Id { get; } = null!;

	/// <summary>
	/// Название.
	/// </summary>
	public CameraName Name { get; set; } = null!;

	/// <summary>
	/// Веб адрес.
	/// </summary>
	public CameraAddress Address { get; set; } = null!;

	/// <summary>
	/// Объект.
	/// </summary>
	public Asset Asset { get; } = null!;

	/// <summary>
	/// ИД объекта.
	/// </summary>
	public AssetId AssetId { get; } = null!;

	/// <summary>
	/// Создает экземпляр <see cref="Camera"/>.
	/// </summary>
	/// <param name="name">Название.</param>
	/// <param name="address">Веб адрес.</param>
	/// <param name="assetId">ИД объекта.</param>
	/// <returns>Экземпляр <see cref="Camera"/>.</returns>
	public static Camera Create(CameraName name, CameraAddress address, AssetId assetId)
	{
		return new(new CameraId(Guid.CreateVersion7()), name, address, assetId);
	}

	private Camera(CameraId id, CameraName name, CameraAddress address, AssetId assetId)
	{
		this.Id = id;
		this.Name = name;
		this.Address = address;
		this.AssetId = assetId;
	}

	/// <summary>
	/// Constructor for EF.
	/// </summary>
	protected Camera() { }
}
