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

using AutoMapper;
using MyOffice.Data.Models.Items;

public class ItemDto
{
	public Guid Id { get; set; }
	public string? Name { get; set; }
	public bool AllowDelete { get; set; }

	public Guid CategoryId { get; set; }
	public ItemCategoryDto? Category { get; set; }
}

public class ItemDtoProfile: Profile
{
	public ItemDtoProfile()
	{
		CreateMap<Item, ItemDto>()
			.ForMember(x => x.Id, o => o.MapFrom(x => x.ItemGlobalId))
			.ForMember(x => x.Name, o => o.MapFrom(x => x.ItemGlobal.Name))
			.ForMember(x => x.AllowDelete, o => o.MapFrom(x => !x.Motions!.Any()))
			;
	}
}