using ReAct_PME.Infrastructure;
using ReAct_PME.Domain;


namespace ReAct_PME.Application
{
    public partial class DT_CONVERSATION_LIGNEService(IDT_CONVERSATION_LIGNERepository dt_conversation_ligneRepository) : IDT_CONVERSATION_LIGNEService
    {
		#region CRUD de la table DT_CONVERSATION_LIGNE
		public async Task<bool> Create_Async(DT_CONVERSATION_LIGNE_DTO dt_conversation_ligne)
		{
			if (await dt_conversation_ligneRepository.GetById_Async(dt_conversation_ligne.ID_CONVERSATION_LIGNE) != null)
			{
				return false;
			}
			return await dt_conversation_ligneRepository.Create_Async(dt_conversation_ligne);
		}

		public async Task<bool> Update_Async(Guid ID_CONVERSATION_LIGNE, DT_CONVERSATION_LIGNE_DTO updatedDT_CONVERSATION_LIGNE)
		{
			return await dt_conversation_ligneRepository.Update_Async(ID_CONVERSATION_LIGNE, updatedDT_CONVERSATION_LIGNE);
		}

		public async Task<bool> Delete_Async(Guid ID_CONVERSATION_LIGNE)
		{
			return await dt_conversation_ligneRepository.Delete_Async(ID_CONVERSATION_LIGNE);
		}

		public async Task<IEnumerable<DT_CONVERSATION_LIGNE_DTO>> GetAll_Async(bool IsActifOnly=false)
		{
			return await dt_conversation_ligneRepository.GetAll_Async(IsActifOnly);
		}

		public async Task<DT_CONVERSATION_LIGNE_DTO?> GetById_Async(Guid ID_CONVERSATION_LIGNE)
		{
			return await dt_conversation_ligneRepository.GetById_Async(ID_CONVERSATION_LIGNE);
		}

		#endregion

		#region By_ID_CONVERSATION
		public async Task<IEnumerable<DT_CONVERSATION_LIGNE_DTO>> GetAll_By_ID_CONVERSATION_Async(Guid ID_CONVERSATION)
		{
			return await dt_conversation_ligneRepository.GetAll_By_ID_CONVERSATION_Async(ID_CONVERSATION);
		}

		public async Task<int> GetCount_By_ID_CONVERSATION_Async(Guid ID_CONVERSATION)
		{
			return await dt_conversation_ligneRepository.GetCount_By_ID_CONVERSATION_Async(ID_CONVERSATION);
		}

		public async Task<bool> Delete_By_ID_CONVERSATION_Async(Guid ID_CONVERSATION)
		{
			return await dt_conversation_ligneRepository.Delete_By_ID_CONVERSATION_Async(ID_CONVERSATION);
		}

		#endregion



    }
}
