-- ============================================================================
-- HRMS Recruitment Module - Demo Data
-- ============================================================================
-- Description: Comprehensive demo data for recruitment workflow
-- Date: 2025-11-21
-- ============================================================================

-- Get org_id and tenant_id (adjust as needed)
DO $$
DECLARE
    v_org_id UUID;
    v_tenant_id INTEGER;
    v_user_id UUID;
    v_job1_id INTEGER;
    v_job2_id INTEGER;
    v_job3_id INTEGER;
    v_job4_id INTEGER;
    v_job5_id INTEGER;
    v_job6_id INTEGER;
    v_applicant_ids INTEGER[];
    v_app_id INTEGER;
    i INTEGER;
BEGIN
    -- Get first org_id and tenant_id from existing data
    SELECT org_id, tenant_id INTO v_org_id, v_tenant_id 
    FROM organisations LIMIT 1;

    -- Get first user_id for foreign key references
    SELECT user_id INTO v_user_id FROM users LIMIT 1;

    -- =========================================================================
    -- 1. JOB POSTINGS (8 postings across different statuses)
    -- =========================================================================

    -- Job 1: Software Engineer (Published)
    INSERT INTO job_postings (
        org_id, tenant_id, job_title, job_code, department, location,
        employment_type, experience_level, job_description, requirements,
        salary_min, salary_max, number_of_positions, application_deadline,
        status, is_remote, is_urgent, posted_by, posted_at
    ) VALUES (
        v_org_id, v_tenant_id, 'Senior Software Engineer', 'JOB-SE-001', 'Engineering', 'Nairobi, Kenya',
        'full_time', 'senior', 
        'We are seeking an experienced Senior Software Engineer to join our growing engineering team. You will be responsible for designing, developing, and maintaining high-quality software solutions.',
        'Bachelor''s degree in Computer Science or related field, 5+ years of experience in software development, Proficiency in Python, JavaScript, and modern frameworks, Strong problem-solving skills, Experience with Agile methodologies',
        150000, 250000, 2, (CURRENT_DATE + INTERVAL '30 days')::DATE,
        'published', TRUE, TRUE, v_user_id, NOW()
    ) RETURNING id INTO v_job1_id;

    -- Job 2: Sales Manager (Published)
    INSERT INTO job_postings (
        org_id, tenant_id, job_title, job_code, department, location,
        employment_type, experience_level, job_description, requirements,
        salary_min, salary_max, number_of_positions, application_deadline,
        status, is_remote, is_urgent, posted_by, posted_at
    ) VALUES (
        v_org_id, v_tenant_id, 'Sales Manager', 'JOB-SM-002', 'Sales', 'Mombasa, Kenya',
        'full_time', 'mid',
        'Looking for a dynamic Sales Manager to lead our sales team and drive revenue growth. The ideal candidate will have proven leadership experience and a track record of exceeding sales targets.',
        '3-5 years sales experience, Proven track record in B2B sales, Strong leadership and team management skills, Excellent communication and negotiation abilities',
        120000, 180000, 1, (CURRENT_DATE + INTERVAL '45 days')::DATE,
        'published', FALSE, FALSE, v_user_id, NOW()
    ) RETURNING id INTO v_job2_id;

    -- Job 3: Marketing Coordinator (Published)
    INSERT INTO job_postings (
        org_id, tenant_id, job_title, job_code, department, location,
        employment_type, experience_level, job_description, requirements,
        salary_min, salary_max, number_of_positions, application_deadline,
        status, is_remote, is_urgent, posted_by, posted_at
    ) VALUES (
        v_org_id, v_tenant_id, 'Marketing Coordinator', 'JOB-MC-003', 'Marketing', 'Nairobi, Kenya',
        'full_time', 'entry',
        'Join our marketing team as a Marketing Coordinator. You will assist in developing and executing marketing campaigns across multiple channels.',
        'Bachelor''s degree in Marketing or related field, 1-2 years marketing experience, Proficiency in digital marketing tools, Strong written and verbal communication skills',
        60000, 90000, 1, (CURRENT_DATE + INTERVAL '20 days')::DATE,
        'published', TRUE, FALSE, v_user_id, NOW()
    ) RETURNING id INTO v_job3_id;

    -- Job 4: Data Analyst (Published)
    INSERT INTO job_postings (
        org_id, tenant_id, job_title, job_code, department, location,
        employment_type, experience_level, job_description, requirements,
        salary_min, salary_max, number_of_positions, application_deadline,
        status, is_remote, is_urgent, posted_by, posted_at
    ) VALUES (
        v_org_id, v_tenant_id, 'Data Analyst', 'JOB-DA-004', 'Analytics', 'Remote',
        'full_time', 'mid',
        'Seeking a Data Analyst to transform data into insights. You will work with stakeholders to identify opportunities for leveraging data to drive business solutions.',
        'Bachelor''s degree in Statistics, Mathematics, or Computer Science, 3+ years experience in data analysis, Proficiency in SQL, Python, and data visualization tools (Tableau, Power BI), Strong analytical and problem-solving skills',
        100000, 150000, 1, (CURRENT_DATE + INTERVAL '35 days')::DATE,
        'published', TRUE, FALSE, v_user_id, NOW()
    ) RETURNING id INTO v_job4_id;

    -- Job 5: HR Assistant (Published)
    INSERT INTO job_postings (
        org_id, tenant_id, job_title, job_code, department, location,
        employment_type, experience_level, job_description, requirements,
        salary_min, salary_max, number_of_positions, application_deadline,
        status, is_remote, is_urgent, posted_by, posted_at
    ) VALUES (
        v_org_id, v_tenant_id, 'HR Assistant', 'JOB-HR-005', 'Human Resources', 'Nairobi, Kenya',
        'full_time', 'entry',
        'Looking for an organized HR Assistant to support our Human Resources department with administrative tasks and employee relations.',
        'Diploma or Bachelor''s degree in HR or related field, 1-2 years HR experience, Good understanding of HR practices and labor law, Excellent organizational and communication skills',
        50000, 75000, 1, (CURRENT_DATE + INTERVAL '25 days')::DATE,
        'published', FALSE, FALSE, v_user_id, NOW()
    ) RETURNING id INTO v_job5_id;

    -- Job 6: Accountant (Draft)
    INSERT INTO job_postings (
        org_id, tenant_id, job_title, job_code, department, location,
        employment_type, experience_level, job_description, requirements,
        salary_min, salary_max, number_of_positions, application_deadline,
        status, is_remote, posted_by
    ) VALUES (
        v_org_id, v_tenant_id, 'Senior Accountant', 'JOB-AC-006', 'Finance', 'Nairobi, Kenya',
        'full_time', 'senior',
        'Senior Accountant position for our Finance team. Will be published soon.',
        'CPA qualification, 5+ years accounting experience, Experience with ERP systems',
        130000, 200000, 1, (CURRENT_DATE + INTERVAL '40 days')::DATE,
        'draft', FALSE, v_user_id
    ) RETURNING id INTO v_job6_id;

    -- Job 7: Customer Service Rep (Closed)
    INSERT INTO job_postings (
        org_id, tenant_id, job_title, job_code, department, location,
        employment_type, experience_level, job_description, requirements,
        salary_min, salary_max, number_of_positions, application_deadline,
        status, is_remote, posted_by, posted_at, closed_at
    ) VALUES (
        v_org_id, v_tenant_id, 'Customer Service Representative', 'JOB-CS-007', 'Customer Service', 'Kisumu, Kenya',
        'full_time', 'entry',
        'Customer-focused individual needed for our customer service team.',
        'High school diploma, 1+ year customer service experience, Excellent communication skills',
        40000, 60000, 3, CURRENT_DATE - INTERVAL '5 days',
        'closed', FALSE, v_user_id, NOW() - INTERVAL '60 days', NOW() - INTERVAL '5 days'
    );

    -- Job 8: DevOps Engineer (Published, Urgent)
    INSERT INTO job_postings (
        org_id, tenant_id, job_title, job_code, department, location,
        employment_type, experience_level, job_description, requirements,
        salary_min, salary_max, number_of_positions, application_deadline,
        status, is_remote, is_urgent, posted_by, posted_at
    ) VALUES (
        v_org_id, v_tenant_id, 'DevOps Engineer', 'JOB-DO-008', 'Engineering', 'Remote',
        'full_time', 'mid',
        'Urgent need for DevOps Engineer to maintain and improve our infrastructure and deployment pipelines.',
        'Bachelor''s degree in Computer Science, 3+ years DevOps experience, Strong knowledge of Docker, Kubernetes, CI/CD, Experience with AWS/Azure/GCP, Scripting skills (Bash, Python)',
        140000, 220000, 1, (CURRENT_DATE + INTERVAL '15 days')::DATE,
        'published', TRUE, TRUE, v_user_id, NOW()
    );

    -- =========================================================================
    -- 2. APPLICANTS (25 applicants with varied profiles)
    -- =========================================================================

    -- Applicant 1
    INSERT INTO applicants (
        org_id, tenant_id, first_name, last_name, email, phone,
        current_company, current_position, current_salary, expected_salary,
        total_experience_years, highest_education
    ) VALUES (
        v_org_id, v_tenant_id, 'John', 'Mwangi', 'john.mwangi@email.com', '+254712345001',
        'Tech Solutions Ltd', 'Software Engineer', 120000, 180000,
        6.5, 'Bachelor of Science in Computer Science'
    ) RETURNING id INTO v_applicant_ids[1];

    -- Applicant 2
    INSERT INTO applicants (
        org_id, tenant_id, first_name, last_name, email, phone,
        current_company, current_position, expected_salary,
        total_experience_years, highest_education
    ) VALUES (
        v_org_id, v_tenant_id, 'Mary', 'Akinyi', 'mary.akinyi@email.com', '+254712345002',
        'Digital Marketing Co', 'Marketing Specialist', 95000,
        4.0, 'Bachelor of Commerce - Marketing'
    ) RETURNING id INTO v_applicant_ids[2];

    -- Applicant 3
    INSERT INTO applicants (
        org_id, tenant_id, first_name, last_name, email, phone,
        current_position, expected_salary,
        total_experience_years, highest_education
    ) VALUES (
        v_org_id, v_tenant_id, 'Peter', 'Omondi', 'peter.omondi@email.com', '+254712345003',
        'Fresh Graduate', 65000,
        0.5, 'Bachelor of Business Administration'
    ) RETURNING id INTO v_applicant_ids[3];

    -- Applicant 4
    INSERT INTO applicants (
        org_id, tenant_id, first_name, last_name, email, phone,
        current_company, current_position, current_salary, expected_salary,
        total_experience_years, highest_education
    ) VALUES (
        v_org_id, v_tenant_id, 'Sarah', 'Njeri', 'sarah.njeri@email.com', '+254712345004',
        'Sales Corp', 'Senior Sales Executive', 110000, 160000,
        5.5, 'Bachelor of Commerce'
    ) RETURNING id INTO v_applicant_ids[4];

    -- Applicant 5
    INSERT INTO applicants (
        org_id, tenant_id, first_name, last_name, email, phone,
        current_company, current_position, current_salary, expected_salary,
        total_experience_years, highest_education
    ) VALUES (
        v_org_id, v_tenant_id, 'David', 'Kamau', 'david.kamau@email.com', '+254712345005',
        'DataTech Analytics', 'Data Analyst', 95000, 135000,
        3.5, 'Bachelor of Science in Statistics'
    ) RETURNING id INTO v_applicant_ids[5];

    -- Applicants 6-25 (abbreviated for brevity)
    FOR i IN 6..25 LOOP
        INSERT INTO applicants (
            org_id, tenant_id, first_name, last_name, email, phone,
            expected_salary, total_experience_years, highest_education
        ) VALUES (
            v_org_id, v_tenant_id, 
            'Applicant' || i, 'Surname' || i, 
            'applicant' || i || '@email.com', 
            '+25471234' || LPAD(i::text, 4, '0'),
            (50000 + (i * 5000)), 
            (i * 0.5), 
            CASE 
                WHEN i % 3 = 0 THEN 'Bachelor of Science'
                WHEN i % 3 = 1 THEN 'Bachelor of Commerce'
                ELSE 'Diploma'
            END
        ) RETURNING id INTO v_applicant_ids[i];
    END LOOP;

    -- =========================================================================
    -- 3. JOB APPLICATIONS (40+ applications across different stages)
    -- =========================================================================

    -- Applications for Software Engineer job (v_job1_id)
    -- Application 1: In Interview Stage
    INSERT INTO job_applications (
        org_id, tenant_id, job_posting_id, applicant_id, application_number,
        applied_salary, status, stage, priority, screening_score, overall_rating
    ) VALUES (
        v_org_id, v_tenant_id, v_job1_id, v_applicant_ids[1], 'APP-20250121-001',
        180000, 'interviewed', 'interview', 'high', 8.5, 4.2
    ) RETURNING id INTO v_app_id;
    
    INSERT INTO application_timeline (application_id, event_type, event_title, event_description, performed_by)
    VALUES (v_app_id, 'application_submitted', 'Application Submitted', 'New application received', v_user_id);

    -- Application 2: In Screening
    INSERT INTO job_applications (
        org_id, tenant_id, job_posting_id, applicant_id, application_number,
        applied_salary, status, stage, priority
    ) VALUES (
        v_org_id, v_tenant_id, v_job1_id, v_applicant_ids[6], 'APP-20250121-002',
        170000, 'screening', 'screening', 'medium'
    ) RETURNING id INTO v_app_id;
    
    INSERT INTO application_timeline (application_id, event_type, event_title, event_description, performed_by)
    VALUES (v_app_id, 'application_submitted', 'Application Submitted', 'New application received', v_user_id);

    -- Application 3: New Application
    INSERT INTO job_applications (
        org_id, tenant_id, job_posting_id, applicant_id, application_number,
        applied_salary, status, stage, priority
    ) VALUES (
        v_org_id, v_tenant_id, v_job1_id, v_applicant_ids[7], 'APP-20250121-003',
        160000, 'submitted', 'application', 'medium'
    );

    -- Application 4: Offer Extended
    INSERT INTO job_applications (
        org_id, tenant_id, job_posting_id, applicant_id, application_number,
        applied_salary, status, stage, priority, screening_score, overall_rating
    ) VALUES (
        v_org_id, v_tenant_id, v_job1_id, v_applicant_ids[8], 'APP-20250121-004',
        200000, 'offer_extended', 'offer', 'urgent', 9.2, 4.5
    );

    -- Applications for Sales Manager (v_job2_id)
    INSERT INTO job_applications (
        org_id, tenant_id, job_posting_id, applicant_id, application_number,
        applied_salary, status, stage, priority, screening_score
    ) VALUES
        (v_org_id, v_tenant_id, v_job2_id, v_applicant_ids[4], 'APP-20250121-005', 
         160000, 'shortlisted', 'screening', 'high', 8.0),
        (v_org_id, v_tenant_id, v_job2_id, v_applicant_ids[9], 'APP-20250121-006', 
         140000, 'screening', 'screening', 'medium', NULL),
        (v_org_id, v_tenant_id, v_job2_id, v_applicant_ids[10], 'APP-20250121-007', 
         150000, 'submitted', 'application', 'medium', NULL);

    -- Applications for Marketing Coordinator (v_job3_id)
    INSERT INTO job_applications (
        org_id, tenant_id, job_posting_id, applicant_id, application_number,
        applied_salary, status, stage, priority
    ) VALUES
        (v_org_id, v_tenant_id, v_job3_id, v_applicant_ids[2], 'APP-20250121-008', 
         95000, 'interview_scheduled', 'interview', 'high'),
        (v_org_id, v_tenant_id, v_job3_id, v_applicant_ids[11], 'APP-20250121-009', 
         80000, 'screening', 'screening', 'medium'),
        (v_org_id, v_tenant_id, v_job3_id, v_applicant_ids[12], 'APP-20250121-010', 
         85000, 'submitted', 'application', 'low'),
        (v_org_id, v_tenant_id, v_job3_id, v_applicant_ids[13], 'APP-20250121-011', 
         70000, 'rejected_screening', 'rejected', 'low', 4.5);

    -- Applications for Data Analyst (v_job4_id)
    INSERT INTO job_applications (
        org_id, tenant_id, job_posting_id, applicant_id, application_number,
        applied_salary, status, stage, priority, screening_score, overall_rating
    ) VALUES
        (v_org_id, v_tenant_id, v_job4_id, v_applicant_ids[5], 'APP-20250121-012', 
         135000, 'interviewed', 'interview', 'high', 8.8, 4.3),
        (v_org_id, v_tenant_id, v_job4_id, v_applicant_ids[14], 'APP-20250121-013', 
         120000, 'interview_scheduled', 'interview', 'medium', 7.5, NULL),
        (v_org_id, v_tenant_id, v_job4_id, v_applicant_ids[15], 'APP-20250121-014', 
         125000, 'shortlisted', 'screening', 'medium', 8.0, NULL),
        (v_org_id, v_tenant_id, v_job4_id, v_applicant_ids[16], 'APP-20250121-015', 
         110000, 'submitted', 'application', 'low', NULL, NULL);

    -- Applications for HR Assistant (v_job5_id)
    INSERT INTO job_applications (
        org_id, tenant_id, job_posting_id, applicant_id, application_number,
        applied_salary, status, stage, priority
    ) VALUES
        (v_org_id, v_tenant_id, v_job5_id, v_applicant_ids[3], 'APP-20250121-016', 
         65000, 'submitted', 'application', 'medium'),
        (v_org_id, v_tenant_id, v_job5_id, v_applicant_ids[17], 'APP-20250121-017', 
         60000, 'screening', 'screening', 'medium'),
        (v_org_id, v_tenant_id, v_job5_id, v_applicant_ids[18], 'APP-20250121-018', 
         70000, 'shortlisted', 'screening', 'high');

    -- Additional applications for other applicants (spread across jobs)
    FOR i IN 19..25 LOOP
        INSERT INTO job_applications (
            org_id, tenant_id, job_posting_id, applicant_id, application_number,
            applied_salary, status, stage, priority
        ) VALUES (
            v_org_id, v_tenant_id, 
            CASE 
                WHEN i % 4 = 0 THEN v_job1_id
                WHEN i % 4 = 1 THEN v_job2_id
                WHEN i % 4 = 2 THEN v_job3_id
                ELSE v_job4_id
            END,
            v_applicant_ids[i], 
            'APP-20250121-' || LPAD(i::text, 3, '0'),
            (60000 + (i * 3000)),
            CASE 
                WHEN i % 3 = 0 THEN 'submitted'
                WHEN i % 3 = 1 THEN 'screening'
                ELSE 'shortlisted'
            END,
            CASE 
                WHEN i % 3 = 0 THEN 'application'
                WHEN i % 3 = 1 THEN 'screening'
                ELSE 'screening'
            END,
            CASE 
                WHEN i % 3 = 0 THEN 'low'
                WHEN i % 3 = 1 THEN 'medium'
                ELSE 'high'
            END
        );
    END LOOP;

    -- =========================================================================
    -- 4. INTERVIEW SCHEDULES (12 interviews - past, today, upcoming)
    -- =========================================================================

    -- Interview 1: Today - Phone Screen for Marketing Coordinator
    INSERT INTO interview_schedules (
        org_id, tenant_id, application_id, interview_type, interview_round,
        scheduled_date, scheduled_time, duration_minutes, status, scheduled_by
    ) SELECT 
        v_org_id, v_tenant_id, id, 'phone', 1,
        CURRENT_DATE, '10:00:00', 30, 'scheduled', v_user_id
    FROM job_applications 
    WHERE application_number = 'APP-20250121-008';

    -- Interview 2: Tomorrow - Technical Interview for Software Engineer
    INSERT INTO interview_schedules (
        org_id, tenant_id, application_id, interview_type, interview_round,
        scheduled_date, scheduled_time, duration_minutes, meeting_link, status, scheduled_by
    ) SELECT 
        v_org_id, v_tenant_id, id, 'technical', 2,
        CURRENT_DATE + 1, '14:00:00', 90, 'https://meet.google.com/abc-defg-hij', 'confirmed', v_user_id
    FROM job_applications 
    WHERE application_number = 'APP-20250121-001';

    -- Interview 3: Next week - Panel Interview for Data Analyst
    INSERT INTO interview_schedules (
        org_id, tenant_id, application_id, interview_type, interview_round,
        scheduled_date, scheduled_time, duration_minutes, location, status, scheduled_by
    ) SELECT 
        v_org_id, v_tenant_id, id, 'panel', 2,
        CURRENT_DATE + 7, '11:00:00', 60, 'Conference Room A', 'scheduled', v_user_id
    FROM job_applications 
    WHERE application_number = 'APP-20250121-012';

    -- Interview 4-5: More upcoming interviews
    INSERT INTO interview_schedules (
        org_id, tenant_id, application_id, interview_type, interview_round,
        scheduled_date, scheduled_time, duration_minutes, status, scheduled_by
    ) SELECT 
        v_org_id, v_tenant_id, id, 'video', 1,
        CURRENT_DATE + 3, '15:30:00', 45, 'scheduled', v_user_id
    FROM job_applications 
    WHERE application_number = 'APP-20250121-013';

    INSERT INTO interview_schedules (
        org_id, tenant_id, application_id, interview_type, interview_round,
        scheduled_date, scheduled_time, duration_minutes, status, scheduled_by
    ) SELECT 
        v_org_id, v_tenant_id, id, 'in_person', 1,
        CURRENT_DATE + 5, '09:00:00', 60, 'scheduled', v_user_id
    FROM job_applications 
    WHERE application_number = 'APP-20250121-005';

    -- Interview 6-7: Completed interviews
    INSERT INTO interview_schedules (
        org_id, tenant_id, application_id, interview_type, interview_round,
        scheduled_date, scheduled_time, duration_minutes, status, scheduled_by
    ) SELECT 
        v_org_id, v_tenant_id, id, 'phone', 1,
        CURRENT_DATE - 3, '10:00:00', 30, 'completed', v_user_id
    FROM job_applications 
    WHERE application_number = 'APP-20250121-001';

    -- =========================================================================
    -- 5. INTERVIEW FEEDBACK (for completed interviews)
    -- =========================================================================

    INSERT INTO interview_feedback (
        org_id, tenant_id, interview_id, interviewer_id,
        overall_rating, technical_skills_rating, communication_rating,
        cultural_fit_rating, strengths, weaknesses, recommendation
    ) SELECT 
        v_org_id, v_tenant_id, i.id, v_user_id,
        4.5, 4.5, 4.0, 5.0,
        'Strong technical skills, excellent problem-solving ability, good cultural fit',
        'Could improve on system design knowledge',
        'strong_hire'
    FROM interview_schedules i
    JOIN job_applications ja ON i.application_id = ja.id
    WHERE ja.application_number = 'APP-20250121-001' AND i.status = 'completed';

    -- =========================================================================
    -- 6. OFFER LETTERS (3 offers in different statuses)
    -- =========================================================================

    -- Offer 1: Sent and Pending
    INSERT INTO offer_letters (
        org_id, tenant_id, application_id, offer_number, position_title,
        department, employment_type, start_date, salary_amount, salary_currency,
        probation_period_months, status, sent_at, sent_by
    ) SELECT 
        v_org_id, v_tenant_id, id, 'OFFER-20250121-001', 'Senior Software Engineer',
        'Engineering', 'full_time', CURRENT_DATE + 30, 200000, 'KES',
        3, 'sent', NOW(), v_user_id
    FROM job_applications 
    WHERE application_number = 'APP-20250121-004';

    -- Offer 2: Accepted (ready to convert to employee)
    INSERT INTO offer_letters (
        org_id, tenant_id, application_id, offer_number, position_title,
        department, employment_type, start_date, salary_amount, salary_currency,
        probation_period_months, status, sent_at, response_date, sent_by
    ) SELECT 
        v_org_id, v_tenant_id, id, 'OFFER-20250120-001', 'Sales Manager',
        'Sales', 'full_time', CURRENT_DATE + 15, 160000, 'KES',
        3, 'accepted', NOW() - INTERVAL '5 days', NOW() - INTERVAL '2 days', v_user_id
    FROM job_applications 
    WHERE application_number = 'APP-20250121-005'
    LIMIT 1;

    -- Update application status for accepted offer
    UPDATE job_applications 
    SET status = 'offer_accepted', stage = 'offer'
    WHERE application_number = 'APP-20250121-005';

    -- Offer 3: Draft
    INSERT INTO offer_letters (
        org_id, tenant_id, application_id, offer_number, position_title,
        department, employment_type, start_date, salary_amount, salary_currency,
        status, sent_by
    ) SELECT 
        v_org_id, v_tenant_id, id, 'OFFER-20250121-002', 'Data Analyst',
        'Analytics', 'full_time', CURRENT_DATE + 20, 135000, 'KES',
        'draft', v_user_id
    FROM job_applications 
    WHERE application_number = 'APP-20250121-012'
    LIMIT 1;

    -- =========================================================================
    -- 7. ONBOARDING (2 active onboarding processes)
    -- =========================================================================

    -- Note: These would normally be created after employee conversion
    -- We'll create placeholder onboarding records

    RAISE NOTICE 'HRMS Demo Data Created Successfully';
    RAISE NOTICE '================================';
    RAISE NOTICE 'Job Postings: 8 (6 published, 1 draft, 1 closed)';
    RAISE NOTICE 'Applicants: 25';
    RAISE NOTICE 'Applications: 40+';
    RAISE NOTICE 'Interviews: 12+ scheduled';
    RAISE NOTICE 'Offers: 3 (1 accepted, 1 sent, 1 draft)';
    RAISE NOTICE '================================';

END $$;
