Files
Training-Team2-Zenvy-Jan26/Trenser.Zenvy/Trenser.Zenvy/utilities/Enums.h
T
joelthomastrenser 451ed4fec2 Added employee persistence, serialization, and file loading support
<SRS>SRS02 : Employee Management </SRS>

<Changes>
 - Implemented serialization and deserialization for Employee and GeneralEmployee models
 - Added FileManager integration to load employees from CSV files
 - Introduced ApplicationConfig entries for employee file paths
 - Updated Employee ID handling (getEmployeeId → getId) across project
 - Modified FileIO to auto-create file if not found instead of throwing exception
 - Added constructors for all employee types to support deserialization
 - Implemented loadEmployees in service and loadStates in controller
 - Ensured default admin creation if none exists during load
 - Added StringHelper utility for extracting numeric IDs
 - Extended Enums with string conversion and parsing utilities
 - Added initial CSV files for Employee and GeneralEmployee data
 - Improved login error message formatting and minor cleanup
 - Setup gitignore to not track csv files
</Changes>
2026-04-10 13:17:50 +05:30

210 lines
4.4 KiB
C++

#pragma once
#include <string>
namespace Enums {
enum class AccountStatus
{
ACTIVE,
INACTIVE
};
enum class TeamStatus
{
IN_TEAM,
NOT_IN_TEAM
};
enum class CandidateStatus
{
PENDING,
SHORTLISTED,
REJECTED
};
enum class NotificationStatus
{
READ,
UNREAD
};
enum class LeaveStatus
{
PENDING,
APPROVED,
REJECTED
};
enum class LeaveType
{
GENERAL,
MEDICAL,
RESTRICTED
};
enum class JobListingStatus
{
OPEN,
CLOSED
};
enum class TicketStatus
{
OPEN,
RESOLVED,
CLOSED
};
enum class TicketType
{
IT,
FINANCE,
ATTENDANCE,
UNKNOWN
};
enum class EmployeeDesignation
{
JUNIOR,
SENIOR,
TEAM_LEAD,
INVALID
};
enum class EmployeeType
{
GENERAL,
IT,
FINANCE,
TAG,
HR,
TEAM,
ADMIN,
INVALID
};
enum class LoginStatus
{
SUCCESS,
FIRST_LOGIN,
USER_NOT_FOUND,
INVALID_PASSWORD
};
inline std::string getAccountStatusString(AccountStatus status)
{
switch (status)
{
case AccountStatus::ACTIVE:
return "ACTIVE";
case AccountStatus::INACTIVE:
return "INACTIVE";
default:
return "UNKNOWN";
}
}
inline std::string getEmployeeTypeString(EmployeeType type)
{
switch (type)
{
case EmployeeType::GENERAL:
return "GENERAL";
case EmployeeType::IT:
return "IT";
case EmployeeType::FINANCE:
return "FINANCE";
case EmployeeType::TAG:
return "TAG";
case EmployeeType::HR:
return "HR";
case EmployeeType::TEAM:
return "TEAM";
case EmployeeType::ADMIN:
return "ADMIN";
case EmployeeType::INVALID:
return "INVALID";
default:
return "UNKNOWN";
}
}
inline std::string getTeamStatusString(TeamStatus status)
{
switch (status)
{
case TeamStatus::IN_TEAM:
return "IN_TEAM";
case TeamStatus::NOT_IN_TEAM:
return "NOT_IN_TEAM";
default:
return "UNKNOWN";
}
}
inline std::string getEmployeeDesignationString(EmployeeDesignation designation)
{
switch (designation)
{
case EmployeeDesignation::JUNIOR:
return "JUNIOR";
case EmployeeDesignation::SENIOR:
return "SENIOR";
case EmployeeDesignation::TEAM_LEAD:
return "TEAM_LEAD";
case EmployeeDesignation::INVALID:
return "INVALID";
default:
return "UNKNOWN";
}
}
inline AccountStatus getAccountStatus(const std::string& input)
{
if (input == "ACTIVE")
return AccountStatus::ACTIVE;
if (input == "INACTIVE")
return AccountStatus::INACTIVE;
return AccountStatus::INACTIVE;
}
inline EmployeeType getEmployeeType(const std::string& input)
{
if (input == "GENERAL")
return EmployeeType::GENERAL;
if (input == "IT")
return EmployeeType::IT;
if (input == "FINANCE")
return EmployeeType::FINANCE;
if (input == "TAG")
return EmployeeType::TAG;
if (input == "HR")
return EmployeeType::HR;
if (input == "TEAM")
return EmployeeType::TEAM;
if (input == "ADMIN")
return EmployeeType::ADMIN;
return EmployeeType::INVALID;
}
inline TeamStatus getTeamStatus(const std::string& str)
{
if (str == "IN_TEAM")
return TeamStatus::IN_TEAM;
if (str == "NOT_IN_TEAM")
return TeamStatus::NOT_IN_TEAM;
return TeamStatus::NOT_IN_TEAM;
}
inline EmployeeDesignation getEmployeeDesignation(const std::string& input)
{
if (input == "JUNIOR")
return EmployeeDesignation::JUNIOR;
if (input == "SENIOR")
return EmployeeDesignation::SENIOR;
if (input == "TEAM_LEAD")
return EmployeeDesignation::TEAM_LEAD;
return EmployeeDesignation::INVALID;
}
}