<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="5.0" client="site" method="upgrade">
    <name>CV Matching RSForm Module</name>
    <author>Your Name</author>
    <version>2.0.0</version>
    <description>AI-powered CV matching module that uses RSForm for search input and analyzes application data from external database.</description>
    <files>
        <filename module="mod_cvmatching_rsform">mod_cvmatching_rsform.php</filename>
        <filename>helper.php</filename>
        <filename>database.php</filename>
        <folder>tmpl</folder>
        <folder>css</folder>
        <folder>js</folder>
        <folder>language</folder>
    </files>
    <config>
        <fields name="params">
            <fieldset name="database_config" label="External Database Configuration" addfieldpath="/administrator/components/com_rsform/helpers/fields">
                <field name="db_host"
                       type="text"
                       label="Database Host"
                       default="localhost"
                       filter="string"
                       size="30" />
                
                <field name="db_user"
                       type="text"
                       label="Database Username"
                       default="greatugandajobs_mubmart"
                       filter="string"
                       size="30" />
                
                <field name="db_password"
                       type="password"
                       label="Database Password"
                       default="HisGracE2016"
                       filter="raw"
                       size="30" />
                
                <field name="db_name"
                       type="text"
                       label="Database Name"
                       default="greatugandajobs_dbKayson"
                       filter="string"
                       size="30" />
                
                <field name="db_prefix"
                       type="text"
                       label="Table Prefix"
                       default="rsform_"
                       filter="string"
                       size="20" />
                
                <field name="submissions_table"
                       type="text"
                       label="Submissions Table"
                       default="rsform_submissions"
                       filter="string"
                       size="30" />
            </fieldset>
            
            <fieldset name="forms_config" label="RSForm Configuration">
                <field name="search_form_id"
                       type="rsformformid"
                       label="Search Form ID"
                       description="ID of the RSForm used for searching (Form ID 15)"
                       default="15" />
                
                <field name="applications_form_id"
                       type="rsformformid"
                       label="Applications Form ID"
                       description="ID of the RSForm containing applications (Form ID 7)"
                       default="7" />
            </fieldset>
            
            <fieldset name="field_mapping" label="Field Mapping">
                <field name="field_job_title_search"
                       type="text"
                       label="Job Title Field (Search Form)"
                       default="Application_Job_Title"
                       size="30" />
                
                <field name="field_residence_search"
                       type="text"
                       label="Residence Field (Search Form)"
                       default="Area_of_Residence"
                       size="30" />
                
                <field name="field_gender_search"
                       type="text"
                       label="Gender Field (Search Form)"
                       default="Gender"
                       size="30" />
                
                <field name="field_age_search"
                       type="text"
                       label="Age Field (Search Form)"
                       default="Age"
                       size="30" />
                
                <field name="field_course_search"
                       type="text"
                       label="Course Studied Field (Search Form)"
                       default="Course_Studied"
                       size="30" />
                
                <field name="field_education_search"
                       type="text"
                       label="Highest Education Field (Search Form)"
                       default="Highest_Educational_Attainment"
                       size="30" />
                
                <field name="field_experience_search"
                       type="text"
                       label="Experience Field (Search Form)"
                       default="Total_Years_of_Relevant_Experience"
                       size="30" />
                
                <field name="field_company_search"
                       type="text"
                       label="Company Field (Search Form)"
                       default="Company"
                       size="30" />
                
                <field name="field_job_title_app"
                       type="text"
                       label="Job Title Field (Applications)"
                       default="job-title"
                       size="30" />
                
                <field name="field_residence_app"
                       type="text"
                       label="Residence Field (Applications)"
                       default="Residence"
                       size="30" />
                
                <field name="field_gender_app"
                       type="text"
                       label="Gender Field (Applications)"
                       default="Gender"
                       size="30" />
                
                <field name="field_age_app"
                       type="text"
                       label="Age Field (Applications)"
                       default="Age"
                       size="30" />
                
                <field name="field_course_app"
                       type="text"
                       label="Course Studied Field (Applications)"
                       default="Course_Studied"
                       size="30" />
                
                <field name="field_education_app"
                       type="text"
                       label="Highest Education Field (Applications)"
                       default="Highest_Educational"
                       size="30" />
                
                <field name="field_experience_app"
                       type="text"
                       label="Experience Field (Applications)"
                       default="Experience"
                       size="30" />
                
                <field name="field_company_app"
                       type="text"
                       label="Company Field (Applications)"
                       default="Company"
                       size="30" />
            </fieldset>
            
            <fieldset name="scoring_config" label="Weighted Scoring">
                <field name="weight_experience"
                       type="number"
                       label="Experience Weight (%)"
                       default="40"
                       min="0"
                       max="100"
                       step="5" />
                
                <field name="weight_skills"
                       type="number"
                       label="Skills Weight (%)"
                       default="35"
                       min="0"
                       max="100"
                       step="5" />
                
                <field name="weight_education"
                       type="number"
                       label="Education Weight (%)"
                       default="25"
                       min="0"
                       max="100"
                       step="5" />
                
                <field name="shortlist_threshold"
                       type="number"
                       label="Shortlist Threshold (%)"
                       default="70"
                       min="0"
                       max="100"
                       step="5" />
                
                <field name="max_candidates_display"
                       type="number"
                       label="Max Candidates to Display"
                       default="10"
                       min="1"
                       max="50" />
            </fieldset>
            
            <fieldset name="ai_config" label="AI Configuration">
                <field name="ai_provider"
                       type="list"
                       label="AI Provider"
                       default="chatgpt">
                    <option value="chatgpt">ChatGPT (OpenAI)</option>
                    <option value="claude">Claude (Anthropic)</option>
                    <option value="gemini">Gemini (Google)</option>
                    <option value="deepseek">DeepSeek</option>
                    <option value="none">None (Use Local Scoring Only)</option>
                </field>
                
                <field name="chatgpt_api_key"
                       type="text"
                       label="OpenAI API Key"
                       filter="string"
                       size="50" />
                
                <field name="claude_api_key"
                       type="text"
                       label="Claude API Key"
                       filter="string"
                       size="50" />
                
                <field name="gemini_api_key"
                       type="text"
                       label="Gemini API Key"
                       filter="string"
                       size="50" />
                
                <field name="deepseek_api_key"
                       type="text"
                       label="DeepSeek API Key"
                       filter="string"
                       size="50" />
                
                <field name="ai_model"
                       type="text"
                       label="AI Model"
                       description="Leave empty for default model"
                       default=""
                       size="30" />
            </fieldset>
            
            <fieldset name="display_config" label="Display Settings">
                <field name="show_contact_info"
                       type="radio"
                       label="Show Contact Information"
                       default="1"
                       class="btn-group">
                    <option value="1">Yes</option>
                    <option value="0">No</option>
                </field>
                
                <field name="show_file_attachments"
                       type="radio"
                       label="Show File Attachments"
                       description="Display links to uploaded CV files"
                       default="1"
                       class="btn-group">
                    <option value="1">Yes</option>
                    <option value="0">No</option>
                </field>
                
                <field name="enable_download"
                       type="radio"
                       label="Enable Download Feature"
                       default="1"
                       class="btn-group">
                    <option value="1">Yes</option>
                    <option value="0">No</option>
                </field>
                
                <field name="module_class_suffix"
                       type="text"
                       label="Module Class Suffix"
                       default=""
                       size="30" />
            </fieldset>
        </fields>
    </config>
</extension>