using GestionIntegral.Api.Dtos.Auditoria; using GestionIntegral.Api.Dtos.Contables; using System; using System.Collections.Generic; using System.Threading.Tasks; namespace GestionIntegral.Api.Services.Contables { public interface ICierreCuentaCorrienteService { // Devuelve (Cierre, ErrorCode, ErrorMessage). // ErrorCode = código semántico (CIERRE_FECHA_FUTURA, CIERRE_FECHA_ANTERIOR_A_ULTIMO, CIERRE_DISTRIBUIDOR_BAJA, CIERRE_EMPRESA_INEXISTENTE, CIERRE_ERROR_INTERNO). Task<(CierreCuentaCorrienteDto? Cierre, string? ErrorCode, string? ErrorMessage)> CrearCierreAsync(CrearCierreDto dto, int idUsuario); // ErrorCode = CIERRE_NO_ENCONTRADO, CIERRE_YA_ANULADO, CIERRE_HAY_POSTERIORES_VIGENTES, CIERRE_PERMISO_DENEGADO, CIERRE_ERROR_INTERNO. Task<(CierreCuentaCorrienteDto? Cierre, string? ErrorCode, string? ErrorMessage)> ReabrirCierreAsync(int idCierre, ReabrirCierreDto dto, int idUsuario, bool esSuperAdmin); // Saldo inicial del reporte de cuenta corriente para el filtro fechaDesde: // - Sin cierre previo: 0. // - Con cierre con FechaCorte < fechaDesde: SaldoCierre + sumaNeta(fechaCierre+1 .. fechaDesde-1) sobre 4 fuentes. Task CalcularSaldoInicialReporteAsync(int idDistribuidor, int idEmpresa, DateTime fechaDesde); Task GetByIdAsync(int idCierre); Task GetUltimoVigenteAsync(int idDistribuidor, int idEmpresa); Task> GetAllAsync( int? idDistribuidor, int? idEmpresa, string? estado, DateTime? fechaCorteDesde, DateTime? fechaCorteHasta); Task> GetHistorialAsync(int idCierre); // Auditoría general — filtros cruzados sobre todos los cierres. Task> ObtenerHistorialAsync( DateTime? fechaDesde, DateTime? fechaHasta, int? idUsuarioModifico, string? tipoModificacion, int? idCierreAfectado); } }