namespace MyOffice.Data.Repositories.Account;

using Microsoft.EntityFrameworkCore;
using Models.Accounts;

public class AccountAccountCategoryRepository : AppRepository<AccountAccountCategory>, IAccountAccountCategoryRepository
{
	public List<AccountAccountCategory> Get(Guid userId, Guid accountId, Guid categoryId)
	{
		return _context.AccountAccountCategories
			.Include(x => x.Account)
			.Include(x => x.Category)
			.Where(x => x.AccountId == accountId && x.CategoryId == categoryId && x.Category.UserId == userId)
			.ToList();
	}

	public bool Remove(AccountAccountCategory accountAccountCategory)
	{
		return RemoveBase(accountAccountCategory) > 0;
	}
}