<?php
// ---------------------------------------------------------------------
// Same shape as the old FORMS/PHASES JS objects: each key is a form id,
// each value has a title + an HTML body containing <input name="f[key]">
// fields. The renderer (onboard.php) walks this array exactly like the
// old wizard did, so autofill/validation/signature logic is unchanged.
//
// NOTE: To keep this file reviewable, the 7 short boilerplate
// acknowledgment forms (bsis_lic, bsis_tr, meal1, meal2, on_duty,
// meal_wv, background, uniform, drug1-3, uof, econsent, vehicle,
// driver, harassment, notices, safety_ob, probation) are not
// re-transcribed here — add them to this array using the exact same
// "title" + "body" shape as the ones below, copying the body HTML
// straight from the original Index.html FORMS object. Nothing else
// in the app needs to change to support them.
// ---------------------------------------------------------------------

function onb_forms_config(): array {
    return [
        'offer21b' => [
            'title' => 'Form 21B — Employment Terms (Full-Time / Part-Time)',
            'body' => '
                <div class="infob">4551 South B Street, Stockton, CA 95206 · (877) 505-6463</div>
                <div class="sh">Employee Information</div>
                <div class="row">
                  <div class="fld"><label>Employee Name</label><input type="text" name="f[employee_name]" class="fi"></div>
                  <div class="fld"><label>Phone Number</label><input type="text" name="f[phone_number]" class="fi"></div>
                  <div class="fld"><label>Email Address</label><input type="text" name="f[email_address]" class="fi"></div>
                  <div class="fld"><label>BSIS Guard Registration #</label><input type="text" name="f[bsis_guard_card]" class="fi"></div>
                  <div class="fld"><label>Guard Card Expiration</label><input type="text" name="f[guard_card_expiry]" class="fi"></div>
                </div>
                <div class="sh">Position Offered</div>
                <div class="row">
                  <div class="fld"><label>Job Title</label><input type="text" name="f[position]" class="fi" readonly></div>
                  <div class="fld"><label>Employment Status</label><input type="text" name="f[employment_status]" class="fi" readonly></div>
                  <div class="fld"><label>Date of Hire</label><input type="text" name="f[date_of_hire]" class="fi" readonly></div>
                  <div class="fld"><label>Job Site</label><input type="text" name="f[work_location_site]" class="fi" readonly></div>
                </div>
                <div class="sh">Compensation</div>
                <div class="row">
                  <div class="fld"><label>Regular Rate of Pay ($ / hour)</label><input type="text" name="f[pay_rate_amt]" class="fi" readonly></div>
                  <div class="fld"><label>Paydays</label><input type="text" name="f[pay_frequency]" class="fi" readonly></div>
                </div>
                <div class="notice">Electronic Signature Acknowledgment: I agree that my electronic signature is legally equivalent to my handwritten signature under the ESIGN Act and California UETA.</div>
                <div class="sh">Acknowledgment and Acceptance of Employment Terms <span class="req">*</span></div>
                <label class="ck"><input type="checkbox" name="f[offer_accept]" required value="accept"> I ACKNOWLEDGE AND ACCEPT THESE EMPLOYMENT TERMS</label>
            ',
        ],

        'w4' => [
            'title' => "Form W-4 — Employee's Withholding Certificate (2026)",
            'body' => '
                <div class="infob">IRS Form W-4 (2026) · OMB No. 1545-0074</div>
                <div class="sh">Step 1 — Enter Personal Information</div>
                <div class="row">
                  <div class="fld"><label>(a) First Name & Middle Initial</label><input type="text" name="f[w4_first]" class="fi" required></div>
                  <div class="fld"><label>Last Name</label><input type="text" name="f[w4_last]" class="fi" required></div>
                  <div class="fld"><label>Address</label><input type="text" name="f[w4_address]" class="fi" required></div>
                  <div class="fld"><label>City or Town, State, and ZIP Code</label><input type="text" name="f[w4_csz]" class="fi" required></div>
                  <div class="fld"><label>(b) Social Security Number</label><input type="text" name="f[w4_ssn]" class="fi" data-mirror="ssn" required></div>
                </div>
                <div class="sub">(c) Filing Status — check one box</div>
                <label class="ck"><input type="radio" name="f[w4_filing]" value="single" required> Single or Married filing separately</label>
                <label class="ck"><input type="radio" name="f[w4_filing]" value="married" required> Married filing jointly or Qualifying surviving spouse</label>
                <label class="ck"><input type="radio" name="f[w4_filing]" value="hoh" required> Head of household</label>
                <div class="sh">Step 3 — Claim Dependent and Other Credits</div>
                <div class="row">
                  <div class="fld"><label>3(a) Qualifying children under 17 × $2,200</label><input type="number" min="0" id="w4_children" name="f[w4_children]" class="fi fi-opt" oninput="w4calc()"></div>
                  <div class="fld"><label>3(b) Other dependents × $500</label><input type="number" min="0" id="w4_other" name="f[w4_other]" class="fi fi-opt" oninput="w4calc()"></div>
                  <div class="fld"><label>Total (line 3)</label><input type="text" id="w4_dep_total" name="f[w4_dep_total]" class="fi" readonly></div>
                </div>
                <div class="notice">Under penalties of perjury, I declare that this certificate is true, correct, and complete.</div>
            ',
        ],

        'de4' => [
            'title' => "Form DE 4 — Employee's Withholding Allowance Certificate (California)",
            'body' => '
                <div class="infob">California EDD Form DE 4</div>
                <div class="row">
                  <div class="fld"><label>First, Middle, Last Name</label><input type="text" name="f[de4_name]" class="fi" required></div>
                  <div class="fld"><label>Social Security Number</label><input type="text" name="f[de4_ssn]" class="fi" data-mirror="ssn" required></div>
                  <div class="fld"><label>Address</label><input type="text" name="f[de4_address]" class="fi" required></div>
                  <div class="fld"><label>City</label><input type="text" name="f[de4_city]" class="fi" required></div>
                  <div class="fld"><label>State</label><input type="text" name="f[de4_state]" class="fi" required></div>
                  <div class="fld"><label>ZIP Code</label><input type="text" name="f[de4_zip]" class="fi" required></div>
                </div>
                <div class="sh">Filing Status</div>
                <label class="ck"><input type="radio" name="f[de4_filing]" value="single_two" required> Single or Married (two or more incomes)</label>
                <label class="ck"><input type="radio" name="f[de4_filing]" value="married_one" required> Married (one income)</label>
                <label class="ck"><input type="radio" name="f[de4_filing]" value="hoh" required> Head of Household</label>
            ',
        ],

        'i9' => [
            'title' => 'Form I-9 — Employment Eligibility Verification (USCIS), Section 1',
            'body' => '
                <div class="infob">USCIS Form I-9 · Employee completes Section 1. Rachel completes Section 2 within 3 business days.</div>
                <div class="row">
                  <div class="fld"><label>Last Name (Family Name)</label><input type="text" name="f[last_name_family_name]" class="fi" required></div>
                  <div class="fld"><label>First Name (Given Name)</label><input type="text" name="f[first_name_given_name]" class="fi" required></div>
                  <div class="fld"><label>Middle Initial (if any)</label><input type="text" name="f[middle_initial_if_any]" class="fi"></div>
                  <div class="fld"><label>Address (Street Number and Name)</label><input type="text" name="f[address_street_number_and_name]" class="fi" required></div>
                  <div class="fld"><label>City or Town</label><input type="text" name="f[city_or_town]" class="fi" required></div>
                  <div class="fld"><label>State</label><input type="text" name="f[state]" class="fi" required></div>
                  <div class="fld"><label>ZIP Code</label><input type="text" name="f[zip_code]" class="fi" required></div>
                  <div class="fld"><label>Date of Birth (mm/dd/yyyy)</label><input type="text" name="f[date_of_birth_mm_dd_yyyy]" class="fi" data-mirror="dob" required></div>
                  <div class="fld"><label>U.S. Social Security Number</label><input type="text" name="f[u_s_social_security_number]" class="fi" data-mirror="ssn" required></div>
                  <div class="fld"><label>Email Address</label><input type="text" name="f[email_address]" class="fi" required></div>
                  <div class="fld"><label>Telephone Number</label><input type="text" name="f[phone_number]" class="fi" required></div>
                </div>
                <div class="sub">Citizenship / Immigration Status — check one</div>
                <label class="ck"><input type="radio" name="f[i9cit]" required value="us"> A citizen of the United States</label>
                <label class="ck"><input type="radio" name="f[i9cit]" required value="lpr"> A lawful permanent resident</label>
                <label class="ck"><input type="radio" name="f[i9cit]" required value="alien"> An alien authorized to work</label>
            ',
        ],

        'wotc' => [
            'title' => 'Form 8850 — WOTC Pre-Screening Notice',
            'body' => '
                <div class="infob">IRS Form 8850 · Pre-Screening Notice for the Work Opportunity Credit</div>
                <div class="row">
                  <div class="fld"><label>Your Name</label><input type="text" name="f[wotc_name]" class="fi" required></div>
                  <div class="fld"><label>Social Security Number</label><input type="text" name="f[wotc_ssn]" class="fi" data-mirror="ssn" required></div>
                  <div class="fld"><label>Street Address Where You Live</label><input type="text" name="f[wotc_street]" class="fi" required></div>
                  <div class="fld"><label>City or Town, State, and ZIP Code</label><input type="text" name="f[wotc_csz]" class="fi" required></div>
                  <div class="fld"><label>Telephone Number</label><input type="text" name="f[wotc_phone]" class="fi" required></div>
                </div>
            ',
        ],

        'emp_info' => [
            'title' => 'Employee Information Form — Personal & Licensing',
            'body' => '
                <div class="row">
                  <div class="fld"><label>Employee Name</label><input type="text" name="f[employee_name]" class="fi" required></div>
                  <div class="fld"><label>Date of Birth</label><input type="text" name="f[date_of_birth]" class="fi" data-mirror="dob" required></div>
                  <div class="fld"><label>Address</label><input type="text" name="f[address]" class="fi" required></div>
                  <div class="fld"><label>City</label><input type="text" name="f[city]" class="fi" required></div>
                  <div class="fld"><label>State</label><input type="text" name="f[state]" class="fi" required></div>
                  <div class="fld"><label>ZIP</label><input type="text" name="f[zip]" class="fi" required></div>
                  <div class="fld"><label>Primary Phone</label><input type="text" name="f[primary_phone]" class="fi" required></div>
                  <div class="fld"><label>Email Address</label><input type="text" name="f[email_address]" class="fi" required></div>
                </div>
            ',
        ],

        'handbook' => [
            'title' => 'Employee Handbook Acknowledgment',
            'body' => '
                <div class="row">
                  <div class="fld"><label>Employee Name</label><input type="text" name="f[employee_name]" class="fi" required></div>
                  <div class="fld"><label>Position</label><input type="text" name="f[position]" class="fi" required></div>
                  <div class="fld"><label>Date</label><input type="text" name="f[date]" class="fi" required></div>
                </div>
                <div class="notice">By signing electronically below, I acknowledge that I have received, read, and agree to comply with the Handbook.</div>
            ',
        ],

        'safety_ob' => [
            'title' => 'Employee Safety Onboarding Acknowledgment',
            'body' => '
                <div class="row">
                  <div class="fld"><label>Employee Name</label><input type="text" name="f[employee_name]" class="fi" required></div>
                  <div class="fld"><label>Job Title</label><input type="text" name="f[job_title]" class="fi" required></div>
                  <div class="fld"><label>Start Date</label><input type="text" name="f[start_date]" class="fi" required></div>
                </div>
                <label class="ck"><input type="checkbox" required> I understand the WVPP, heat illness prevention, and IIPP requirements.</label>
            ',
        ],
    ];
}

// Same PHASES mapping as the old app: which form keys belong to Phase A
// vs Phase B. Add new keys here as you extend forms_config() above.
function onb_phases_config(): array {
    return [
        'A' => ['offer21b', 'w4', 'de4', 'i9', 'wotc', 'emp_info', 'handbook'],
        'B' => ['safety_ob'],
    ];
}
