using System; namespace RecruitmentDAL.DTO.Referral { // TREFERRAL — Recruitment Phase 6 "Employee referrals" (see // /Users/venkatv/.claude/plans/can-you-check-the-precious-sunbeam.md, Phase 6): an employee // referral is just another Candidate intake channel (CandidateDTO.Source already reserves // value 4 = Referral for exactly this — see that DTO's doc comment), with its own // tracking + incentive/bonus workflow layered on top via this table. One row per // (ReferringEmployeeId, CandidateId) referral event. // // CandidateId is NOT created here — per this module's established pattern (BgVerification // takes an existing ApplicationId rather than creating an Application inline), the caller // resolves/creates the Candidate first via the existing Candidate/GetCandidateByEmail + // Candidate/SaveCandidate endpoints (Source=4/Referral, SourceDetail=referring employee's // name) and only then calls Referral/SaveReferral with the resulting CandidateId. See // ReferralBLL.SaveReferral's doc comment. // // JobRequisitionId is nullable in spirit but modeled as the repo's standard -1 sentinel // (TAPPLICATION.JobRequisitionId does the same) — a referral may target a specific open // requisition or be a general "I know someone good" referral with no requisition yet. // // BonusStatus is independent of the entity's own soft-delete Status column (same separation // as BgVerificationDTO.CheckStatus vs Status). Bonus payout itself is a separate, manual // admin action (Referral/UpdateReferralBonusStatus) — no payroll integration here, out of // scope for this pass. public class ReferralDTO { #region PrivateMembers private int referralid; private int referringemployeeid = -1; // FK MEMPLOYEE private int candidateid = -1; // FK MCANDIDATE private int jobrequisitionid = -1; // FK TJOBREQUISITION; -1 = general referral, no specific requisition private DateTime referraldate; private byte bonusstatus = ReferralBonusStatus.Pending; private decimal bonusamount; private DateTime? payoutdate; #region Standard private byte status = 1; private short version; private int tenantid; #endregion #region Base private int createdbyid; private DateTime createdon; private string? createdbyname; private int modifiedbyid; private DateTime modifiedon; private string? modifiedbyname; #endregion #endregion #region PublicMembers public int ReferralId { get { return referralid; } set { referralid = value; } } public int ReferringEmployeeId { get { return referringemployeeid; } set { referringemployeeid = value; } } public int CandidateId { get { return candidateid; } set { candidateid = value; } } public int JobRequisitionId { get { return jobrequisitionid; } set { jobrequisitionid = value; } } public DateTime ReferralDate { get { return referraldate; } set { referraldate = value; } } public byte BonusStatus { get { return bonusstatus; } set { bonusstatus = value; } } public decimal BonusAmount { get { return bonusamount; } set { bonusamount = value; } } public DateTime? PayoutDate { get { return payoutdate; } set { payoutdate = value; } } #region Standard public byte Status { get { return status; } set { status = value; } } public short Version { get { return version; } set { version = value; } } public int TenantId { get { return tenantid; } set { tenantid = value; } } #endregion #region Base public int CreatedById { get { return createdbyid; } set { createdbyid = value; } } public DateTime CreatedOn { get { return createdon; } set { createdon = value; } } public string? CreatedByName { get { return createdbyname; } set { createdbyname = value; } } public int ModifiedById { get { return modifiedbyid; } set { modifiedbyid = value; } } public DateTime ModifiedOn { get { return modifiedon; } set { modifiedon = value; } } public string? ModifiedByName { get { return modifiedbyname; } set { modifiedbyname = value; } } #endregion #endregion } // BONUSSTATUS — a byte "enum" per this module's established convention (documented via header // comments/static classes rather than a real C# enum — e.g. BgVerificationCheckStatus, // RecruitmentFlsActionType). FE owns the display-label localization for these values. public static class ReferralBonusStatus { public const byte Pending = 1; // Submitted, awaiting the referred Candidate's outcome public const byte Eligible = 2; // Set automatically once the Candidate's Application reaches a genuine Hired terminal stage public const byte Paid = 3; // Manually set by an admin once payout is processed (out of scope: no payroll integration) public const byte Forfeited = 4; // Manually set by an admin (e.g. candidate rejected, employee left before payout window, policy violation) } }