using GB5Shared.DTO.Framework.Login; using GB5Shared.ResponseStandard; using PayRollDAL.DTO.Employee; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using GB5Shared.DTO.Framework.Criteria; namespace PayRollBLL.Employee { public interface IEmployeeBLL { /// /// Retrieves employee details for the specified employee ID and language. /// /// Unique identifier of the employee. /// Language ID to fetch localized data. Defaults to the system language if empty. /// User login context for security and audit. /// JSON string containing employee details. /// Thrown when retrieval of employee data fails. Task GetEmployee(int employeeId, string LanguageId, LoginDTO LoginDTO); /// /// Saves or updates employee information based on the given input. /// Handles new employee creation, version validation, translation handling, /// and updates to related address and contact records. /// /// Employee data transfer object containing employee details. /// Language ID to determine main or translation record. /// User login context used for auditing and authorization. /// Success message indicating the result of the operation (Save, Update, or Translation Update). /// Thrown when required input objects are null. /// Thrown when version control validation fails. /// Thrown for any general error during employee save operation. Task SaveEmployee(EmployeeDTO EmployeeDTO, string languageId, LoginDTO LoginDTO); /// /// Deletes an employee and its related translation records. /// Ensures translation records are deleted before the main employee record. /// /// Unique identifier of the employee to delete. /// User login context used for auditing and authorization. /// /// A object indicating success or failure with a descriptive message. /// /// Thrown when deletion of employee or related records fails. Task> DeleteEmployee(int EmployeeId, LoginDTO LoginDTO); Task PostTransferEmployeeAdvance( List PostTransferEmployeeAdvanceDTOs, LoginDTO LoginDTO); Task GetTransferEmployeeAdvance(LoginDTO LoginDTO); Task SaveEmployeeSecretKey(int employeeId, string secretKey, LoginDTO loginDTO); Task<(string Json, int Total)> GetSelectListEmployee(int firstNumber, int maxResult, CriteriaDTO criteriaDTO, LoginDTO loginDTO); /// /// Splits the calendar gap between an employee's DateOfJoining and a given separation date /// into years/months/days. /// Task<(int SeparationYears, int SeparationMonths, int SeparationDays)> GetDifferenceFromJoiningDate( int employeeId, string separationDate, LoginDTO loginDTO); /// /// Resolves an EmployeeCode to its EmployeeId for the manual raw-code-entry scan path. /// Returns -1 if no employee has that code for this tenant. /// Task GetEmployeeIdByCode(string employeeCode, LoginDTO loginDTO); /// /// Builds the employee reporting-chain org tree (JSON) for the given scope (CriteriaDTO /// attributes: OUId, EmployeeId). Root scoping mirrors the legacy GB4 /// EmployeeHierarchyDashboard recursive-CTE semantics using a flat query + in-memory tree build. /// Task GetEmployeeHierarchy(CriteriaDTO criteriaDTO, LoginDTO loginDTO, CancellationToken ct); /// /// Assembles the HRMS dashboard (JSON) — headcount breakups, pay cost, attrition, /// attendance/shift summaries, and the embedded org hierarchy widget. The legacy /// workflow-pending-approvals widget is intentionally omitted (no GB5 Activiti equivalent). /// Task GetHRMSDashboard(CriteriaDTO criteriaDTO, LoginDTO loginDTO, CancellationToken ct); /// /// Paged composite employee profile report — returns typed rows (not JSON) since this /// backs a BaseReportEndpoint (export/streaming support), matching the AccountReports /// report-BLL convention rather than this module's usual JSON-string return. /// Task<(List Items, int Total)> GetEmployeeProfileReport( int firstNumber, int maxResult, CriteriaDTO criteriaDTO, LoginDTO loginDTO, CancellationToken ct); /// /// Migrated from GB4 EmployeeBLL.EmployeePostingSelectionList — MM posting/allocation /// history for a given employee (TPOSTINGPOSITION), with an optional FromInventory /// variant. See IEmployeeDAL.EmployeePostingSelectionList for full parity notes. /// Task<(List Items, int Total)> EmployeePostingSelectionList( int firstNumber, int maxResult, CriteriaDTO criteriaDTO, LoginDTO loginDTO, CancellationToken ct); Task<(List Items, int Total)> GetEmployeeVsShiftPattern( int firstNumber, int maxResult, CriteriaDTO criteriaDTO, LoginDTO loginDTO, CancellationToken ct); /// /// GB4 parity: EmployeeBLL.GetEmployeeVsShiftPatternNew (route Get/Employee/Vs/ShiftPattern/Load). /// Distinct from GetEmployeeVsShiftPattern — per-shift-pattern-day DayType/NumberofDays rows. /// Task<(List Items, int Total)> GetEmployeeVsShiftPatternNew( int firstNumber, int maxResult, CriteriaDTO criteriaDTO, LoginDTO loginDTO, CancellationToken ct); Task> GetEmployeeVersionPicklist( int firstNumber, int maxResult, CriteriaDTO criteriaDTO, LoginDTO loginDTO, CancellationToken ct); Task> LegecyBasedEmployeeInformation( int employeeId, LoginDTO loginDTO, CancellationToken ct); Task> GetEmployeeVersionInPayProcess( CriteriaDTO criteriaDTO, LoginDTO loginDTO, CancellationToken ct); Task GetEmployeeVersion(int employeeVersionId, LoginDTO loginDTO, CancellationToken ct); Task> GetDuplicateEmployee(CriteriaDTO criteriaDTO, LoginDTO loginDTO, CancellationToken ct); /// /// GB4 EmployeeBLL.DeleteEmployeeVersion — two hard business-rule guards, deletes the version, /// then rolls MEMPLOYEE/MEMPLOYEEADDON back to the new latest remaining version. Runs inside /// one transaction (see TLeaveBLL.SaveTLeave for the reference transaction pattern). /// Task DeleteEmployeeVersion(int employeeVersionId, LoginDTO loginDTO, CancellationToken ct); /// /// GB4 parity: EmployeeBLL.RegisterDeletion — validates via PayProcessBLL.IsUpdatePossible /// equivalent (blocks if a pay process has already run for this employee/period), then deletes /// future TDAILYATTENDANCE rows from EffectiveFrom onward. /// Task RegisterDeletion(int employeeId, DateTime effectiveFrom, LoginDTO loginDTO, CancellationToken ct); /// /// GB4 parity: EmployeeBLL.UpdateEmployeeShiftPattern — loops the existing single-item /// DAL save across the batch inside one manual transaction (no single owning entity DTO). /// Task UpdateEmployeeShiftPattern(List employeeShiftPatternDTOs, LoginDTO loginDTO, CancellationToken ct); /// /// GB4 parity: EmployeeBLL.GetJOBDetailReport / EmployeeQueryBuilder.GET_EMPLOYEE_JOB_DETAIL — /// wide paged job-opening report (TJOB + GCM masters + party/employee/department joins). /// Task<(List Items, int Total)> GetJOBDetailReport( int firstNumber, int maxResult, CriteriaDTO criteriaDTO, LoginDTO loginDTO, CancellationToken ct); } }