namespace MyOffice.Web.Models.Account
{
	using Data.Models.Accounts;
	using Services.Account.Domain;
	using User;

	public class AccessRightsViewModel
	{
		public UserViewModel User { get; set; } = null!;
		public bool IsAllowRead { get; set; }
		public bool IsAllowWrite { get; set; }
		public bool IsAllowManage { get; set; }
	}

	public static class AccessRightsViewModelExtensions
	{
		public static AccessRightsViewModel ToModel(this AccountAccessDto accountAccess)
		{
			return new AccessRightsViewModel
			{
				User = accountAccess.User!.ToModel(),
				IsAllowManage = accountAccess.IsAllowManage,
				IsAllowRead = accountAccess.IsAllowRead,
				IsAllowWrite = accountAccess.IsAllowWrite,
			};
		}
	}
}
