using System.Collections.Generic;
using System.Threading.Tasks;
using MDL.Models;

namespace DAL.Interfaces
{
    /// <summary>
    /// 客户资料的数据访问接口
    /// </summary>
    public interface ICustomerRepository
    {
        /// <summary>
        /// 创建客户记录
        /// </summary>
        /// <param name="entity">客户实体</param>
        /// <returns>创建的记录ID</returns>
        Task<int> CreateAsync(CustomerEntity entity);
        
        /// <summary>
        /// 根据ID获取客户记录
        /// </summary>
        /// <param name="id">记录ID</param>
        /// <returns>客户实体</returns>
        Task<CustomerEntity?> GetByIdAsync(int id);
        
        /// <summary>
        /// 根据客户代码获取客户记录
        /// </summary>
        /// <param name="customerCode">客户代码</param>
        /// <returns>客户实体</returns>
        Task<CustomerEntity?> GetByCustomerCodeAsync(string customerCode);
        
        /// <summary>
        /// 更新客户记录
        /// </summary>
        /// <param name="entity">客户实体</param>
        /// <returns>更新是否成功</returns>
        Task<bool> UpdateAsync(CustomerEntity entity);
        
        /// <summary>
        /// 删除客户记录
        /// </summary>
        /// <param name="id">记录ID</param>
        /// <returns>删除是否成功</returns>
        Task<bool> DeleteAsync(int id);
        
        /// <summary>
        /// 获取所有客户记录
        /// </summary>
        /// <returns>客户实体列表</returns>
        Task<List<CustomerEntity>> GetAllAsync();
        
        /// <summary>
        /// 检查客户是否存在
        /// </summary>
        /// <param name="customerCode">客户代码</param>
        /// <returns>是否存在</returns>
        Task<bool> ExistsAsync(string customerCode);

        /// <summary>
        /// 根据ID列表批量获取客户记录
        /// </summary>
        /// <param name="ids">ID列表</param>
        /// <returns>客户实体列表</returns>
        Task<List<CustomerEntity>> GetByIdsAsync(List<int> ids);
    }
}