# CURA Job Application Process - Industry Best Practices Implementation

## Overview
The CURA platform implements a professional job application process that meets healthcare industry standards, allowing nurses to apply to positions with CVs, cover letters, and professional documents.

## Application Process Flow

### 1. **Nurse Profile & Document Management**

**Location**: `/nurse` dashboard > "My Profile"

#### Document Upload
Nurses can upload various professional documents:
- **CV/Resume** - Primary document for job applications
- **Professional License** - RN, LPN, NP, etc.
- **NCLEX Certificate** - Nursing exam certification
- **IELTS/OET Score** - English language proficiency
- **Passport/ID** - Identity verification
- **Other Documents** - Additional supporting materials

**File Requirements**:
- Formats: PDF, DOC, DOCX, JPG, PNG
- Maximum Size: 5MB per document
- Uploaded documents are stored securely and linked to nurse profile

**Document Status**:
- `uploaded` - Document received and stored
- `verified` - Document verified by employer/admin

### 2. **Job Browsing & Application**

**Location**: `/jobs` public listing

#### Application Requirements
When applying to a job, nurses must:
1. **Select a CV/Document** - Choose from uploaded documents (required)
2. **Write Optional Cover Letter** - Add personalized message to employer
3. **Submit Application** - One-time submission per job per nurse

**Validation**:
- CV document is required to proceed with application
- Cover letter is optional but recommended (max 5000 characters)
- Duplicate applications are prevented

### 3. **Employer Dashboard - Application Review**

**Location**: Employer portal > Applications

#### Application Details Displayed
- **Applicant Information**
  - Name
  - Profile link to view full professional profile
  
- **Documents**
  - CV/Resume with download link
  - Document type and upload date
  - Document status (uploaded/verified)
  
- **Cover Letter**
  - Formatted cover letter text
  - Displayed with proper formatting preserved
  
- **Application Status**
  - Current status: applied, shortlisted, interview, offer, hired, rejected
  - Ability to update status
  
- **Internal Notes**
  - Employer notes on the candidate
  - Add/edit/delete notes
  - Track employer feedback

#### Employer Actions
- View applicant's CV/documents
- Add internal notes about the candidate
- Update application status through hiring pipeline
- Contact candidate for next steps

## Database Schema

### NurseDocument Table
```sql
- id (primary key)
- nurse_profile_id (foreign key)
- type (document type: CV, License, etc.)
- doc_type (legacy compatibility)
- file_path (storage path)
- file_url (URL to access)
- original_filename
- verified (boolean)
- status (uploaded, verified, rejected)
- verified_at (timestamp)
- created_at / updated_at
```

### JobApplication Table
```sql
- id (primary key)
- job_posting_id (foreign key)
- user_id (foreign key)
- nurse_profile_id (foreign key)
- status (applied, shortlisted, interview, offer, hired, rejected)
- cover_letter (text)
- cover_letter_text (text)
- cv_document_id (foreign key → NurseDocument) ⭐ NEW
- notes (employer notes)
- applied_at (timestamp)
- created_at / updated_at
```

## Key Features

### ✅ Document Management
- Unlimited document uploads
- Document type categorization
- File type validation (PDF, Word, Image)
- File size limits (5MB max)
- Secure storage with access control

### ✅ Application Tracking
- Nurses cannot apply twice to same position
- Complete application history in nurse dashboard
- Status tracking (applied → hired)
- Application timeline visible to both parties

### ✅ CV Integration
- CV linked to each application
- Employers can view/download applicant CV
- Multiple CV versions supported (nurses can upload multiple)
- Document verification system

### ✅ Communication
- Cover letter included in application
- Internal notes by employers
- Document upload dates tracked
- Professional document handling

### ✅ Data Security
- Files stored in secure storage directory
- Access control based on ownership
- Document deletion support
- Audit trail via timestamps

## API Endpoints

### Nurse Profile
```
GET    /nurse/profile          - View profile
GET    /nurse/profile/edit     - Edit profile form
POST   /nurse/profile          - Update profile
POST   /nurse/profile/documents - Upload document
DELETE /nurse/profile/documents/{id} - Delete document
```

### Job Applications
```
POST   /jobs/{jobPosting}/apply     - Submit application
GET    /nurse/applications          - View my applications
```

### Employer
```
GET    /applications/{jobApplication}     - View application detail
PUT    /applications/{jobApplication}     - Update status/notes
POST   /applications/{jobApplication}/notes - Add note
PUT    /notes/{applicationNote}           - Update note
DELETE /notes/{applicationNote}           - Delete note
```

## User Experience Flow

### For Nurses:
1. Create/Update Profile
2. Upload CV and relevant documents
3. Browse job listings
4. Select desired position
5. Choose CV from uploaded documents
6. (Optional) Write cover letter
7. Submit application
8. Track application status in dashboard

### For Employers:
1. Post job position
2. Review incoming applications
3. View applicant CV
4. Read cover letter
5. Add internal notes
6. Update application status
7. Contact shortlisted candidates
8. Track hiring pipeline

## Best Practices Implemented

✅ **Industry Standard CV Process** - Healthcare hiring standard requiring CV submission
✅ **Document Security** - Secure file storage with access controls
✅ **Duplicate Prevention** - One application per nurse per job
✅ **Status Tracking** - Clear hiring pipeline stages
✅ **Communication Trail** - Notes and timestamps for accountability
✅ **Professional UI** - Clean, intuitive application interface
✅ **Validation** - Client and server-side validation
✅ **Accessibility** - Support for various file formats
✅ **Audit Trail** - Complete history of applications and updates

## Migration Notes

The `cv_document_id` field was added to JobApplication table to:
- Link submitted CV to specific application
- Allow employers to access applicant documents
- Support multiple CV versions per nurse
- Enable document verification workflows
- Maintain audit trail of submitted documents

## Future Enhancements

- Document expiration tracking (licenses, certifications)
- Document verification workflow (admin approval)
- Application templates by employer
- Bulk document upload
- Document OCR/indexing
- Video cover letters
- Application analytics
- Email notifications with CV attached
