using AutoMapper;
using DigitalData.Core.Abstraction.Application;
using DigitalData.Core.Abstraction.Application.Repository;

namespace DigitalData.Core.Application
{
    /// <summary>
    /// Provides a concrete implementation of a basic CRUD service that uses a single Data Transfer Object (DTO) for all CRUD operations.
    /// This service simplifies the management of entities by utilizing a consistent object model throughout create, read, update, and delete operations.
    /// It extends the generic CRUDService by specifying the same DTO type for all generic parameters, facilitating a straightforward mapping between the entity and its data transfer representation.
    /// </summary>
    /// <typeparam name="TDto">The Data Transfer Object type used for all operations.</typeparam>
    /// <typeparam name="TEntity">The entity type being managed by this service.</typeparam>
    /// <typeparam name="TId">The type of the identifier for the entity.</typeparam>
    /// <remarks>
    /// This service is ideal for scenarios where a single DTO is adequate to represent the entity in all operations,
    /// reducing the need for multiple DTOs and simplifying the data mapping process. It leverages AutoMapper for object mapping
    /// and a culture-specific translation service for any necessary text translations, ensuring a versatile and internationalized approach to CRUD operations.
    /// </remarks>
    [Obsolete("Use MediatR")]
    public class BasicCRUDService<TCRUDRepository, TDto, TEntity, TId> :
        CRUDService<TCRUDRepository, TDto, TDto, TEntity, TId>, IBasicCRUDService<TDto, TEntity, TId>
         where TCRUDRepository : ICRUDRepository<TEntity, TId> where TDto : class where TEntity : class
    {
        /// <summary>
        /// Initializes a new instance of the BasicCRUDService with the specified repository, translation service, and AutoMapper configuration.
        /// </summary>
        /// <param name="repository">The CRUD repository for accessing and manipulating entity data.</param>
        /// <param name="mapper">The AutoMapper instance for mapping between DTOs and entities.</param>
        public BasicCRUDService(TCRUDRepository repository, IMapper mapper) :
            base(repository, mapper)
        {
        }
    }
}