/// <see cref="MyOffice.Data.Models.Accounts.AccountCategory"/>
namespace MyOffice.Services.Account.Domain;

using AutoMapper;
using MyOffice.Data.Models.Accounts;

public class AccountCategoryDto
{
	public Guid Id { get; set; }
	public Guid UserId { get; set; }
	public string Name { get; set; } = null!;
	public bool AllowDelete { get; set; }
}

public class AccountCategoryDtoProfile: Profile
{
	public AccountCategoryDtoProfile()
	{
		CreateMap<AccountCategory, AccountCategoryDto>()
			.ForMember(x => x.Id, o => o.MapFrom(x => x.Id))
			.ForMember(x => x.AllowDelete, o => o.MapFrom(x => !x.Accounts!.Any()))
			;
	}
}