<?php

/*
|--------------------------------------------------------------------------
| Witness Statement questionnaire
|--------------------------------------------------------------------------
|
| The witness-statement questionnaire is configuration, not hard-coded view
| logic. It models the Scottish Redress Scheme witness-statement framework as
| a flat list of "sections", each belonging to one of nine top-level GROUPS
| (the headings a handler sees). A section carries its questions; a question
| carries its input type, optional autofill mapping (a dotted path onto the
| client/claim), and — for sections that can be evidenced — a set of evidence
| categories used to surface confirmed DsarEvidenceItem findings as suggested
| answers. Nothing here re-runs extraction: it only maps existing findings.
|
| Question `type`s handled by the shared question-field component:
|   short_text | long_text | date | select | boolean | multiselect
|   | repeater (repeating rows, e.g. placement history) | declaration
|
| `autofill` dotted paths are resolved by WitnessStatementService against the
| client and its claim (e.g. client.full_name, claim.case_number).
|
| The nine groups (order matters — this is the questionnaire spine):
|   Personal Details, Life Before Care, Entry Into Care, Care Placements,
|   Details of Abuse, Reporting the Abuse, Impact on Life, Supporting Evidence,
|   Declaration
|
*/

return [

    // Ordered list of the nine top-level groups. Sections reference these.
    'groups' => [
        'Personal Details',
        'Life Before Care',
        'Entry Into Care',
        'Care Placements',
        'Details of Abuse',
        'Reporting the Abuse',
        'Impact on Life',
        'Supporting Evidence',
        'Declaration',
    ],

    'sections' => [

        /*
        |----------------------------------------------------------------------
        | GROUP: Personal Details
        |----------------------------------------------------------------------
        */
        [
            'key'   => 'client_details',
            'group' => 'Personal Details',
            'title' => 'Client & Application Details',
            'description' => 'Core identifying details for the applicant and this statement.',
            'questions' => [
                ['key' => 'applicant_full_name', 'type' => 'short_text', 'label' => 'Applicant full name', 'required' => true, 'autofill' => 'client.full_name'],
                ['key' => 'date_of_birth', 'type' => 'date', 'label' => 'Date of birth', 'required' => true, 'autofill' => 'client.date_of_birth'],
                ['key' => 'current_address', 'type' => 'long_text', 'label' => 'Current address', 'required' => true, 'autofill' => 'client.current_address'],
                ['key' => 'application_reference', 'type' => 'short_text', 'label' => 'Application reference', 'autofill' => 'claim.case_number'],
                ['key' => 'occupation', 'type' => 'short_text', 'label' => 'Occupation (current or at the time of events)'],
                ['key' => 'statement_taker', 'type' => 'short_text', 'label' => 'Statement taker / interviewer', 'autofill' => 'user.name'],
                ['key' => 'meeting_datetime', 'type' => 'short_text', 'label' => 'Date & time of meeting / call'],
                ['key' => 'statement_method', 'type' => 'select', 'label' => 'Method of statement', 'options' => ['In person', 'Telephone', 'Video']],
                ['key' => 'legal_representative', 'type' => 'short_text', 'label' => 'Legal representative / organisation', 'autofill' => 'solicitor.name'],
                ['key' => 'support_needs', 'type' => 'long_text', 'label' => 'Any immediate support needs or adjustments required?'],
            ],
        ],
        [
            'key'   => 'opening_consent',
            'group' => 'Personal Details',
            'title' => 'Opening & Consent',
            'description' => 'Consent to give and use this statement in the Scottish Redress application.',
            'questions' => [
                ['key' => 'happy_to_continue', 'type' => 'boolean', 'label' => 'Are you happy to continue today?'],
                ['key' => 'support_person', 'type' => 'short_text', 'label' => 'Would you like anyone with you, or to continue alone?'],
                ['key' => 'topics_to_avoid', 'type' => 'long_text', 'label' => 'Any words or topics you would prefer be avoided unless absolutely necessary?'],
                ['key' => 'understands_purpose', 'type' => 'boolean', 'label' => 'Do you understand this statement is to support your Scottish Redress application?', 'required' => true],
                ['key' => 'consent_redress', 'type' => 'boolean', 'label' => 'Do you consent to this statement being used for your Scottish Redress application?', 'required' => true],
                ['key' => 'conviction_advised', 'type' => 'boolean', 'label' => 'Have you been told any serious criminal conviction may affect your Redress application?'],
            ],
        ],
        [
            'key'   => 'eligibility',
            'group' => 'Personal Details',
            'title' => 'Eligibility Preamble',
            'description' => 'Basic eligibility questions for the care setting.',
            'questions' => [
                ['key' => 'under_18', 'type' => 'boolean', 'label' => 'Were you under 18 when you were in this care setting?', 'required' => true],
                ['key' => 'in_scotland', 'type' => 'boolean', 'label' => 'Was the care setting in Scotland?', 'required' => true],
                ['key' => 'residing_or_attending', 'type' => 'short_text', 'label' => 'Were you living there, or attending/residing as part of care arrangements?'],
                ['key' => 'approx_year_age', 'type' => 'short_text', 'label' => 'Do you remember the approximate year or your age at the time?'],
                ['key' => 'placing_body', 'type' => 'multiselect', 'label' => 'Who placed you there?', 'options' => ['Social work', 'Court', "Children's panel", 'Local authority', 'Health authority', 'Religious organisation', 'Voluntary organisation', 'School', 'Other']],
                ['key' => 'setting_type', 'type' => 'multiselect', 'label' => 'What type of placement was it?', 'options' => ["Children's home", 'Foster placement', 'Residential school', 'Approved school', 'Secure unit', 'Remand/assessment centre', 'Hospital', 'Boarding school', 'Other']],
            ],
        ],

        /*
        |----------------------------------------------------------------------
        | GROUP: Life Before Care  (Template section 1)
        |----------------------------------------------------------------------
        */
        [
            'key'   => 'life_before_care',
            'group' => 'Life Before Care',
            'title' => 'Personal Background & Life Before Care',
            'description' => 'Family, home life, health and education before entering care.',
            'evidence_categories' => ['social_care', 'neglect', 'trauma'],
            'questions' => [
                ['key' => 'where_grew_up', 'type' => 'long_text', 'label' => 'Where did you grow up?'],
                ['key' => 'family_home_life', 'type' => 'long_text', 'label' => 'Tell me about your family and home life before going into care.'],
                ['key' => 'relationship_parents', 'type' => 'long_text', 'label' => 'What was your relationship like with your parents or carers?'],
                ['key' => 'home_difficulties', 'type' => 'long_text', 'label' => 'Any difficulties at home — neglect, poverty, parental illness, family breakdown, abuse, social work involvement?'],
                ['key' => 'age_things_changed', 'type' => 'short_text', 'label' => 'How old were you when things started to change?'],
                ['key' => 'health_before', 'type' => 'long_text', 'label' => 'Before entering care, what was your health like?'],
                ['key' => 'education_before', 'type' => 'long_text', 'label' => 'Before entering care, what was your education and school life like?'],
                ['key' => 'wellbeing_before', 'type' => 'long_text', 'label' => 'Before entering care, what was your behaviour, emotional wellbeing and general wellbeing like?'],
                ['key' => 'vulnerabilities', 'type' => 'long_text', 'label' => 'Any disabilities, learning needs, health conditions or other relevant background?'],
                ['key' => 'always_known_by_name', 'type' => 'boolean', 'label' => 'Have you always been known by your current name?'],
            ],
        ],

        /*
        |----------------------------------------------------------------------
        | GROUP: Entry Into Care  (Template section 2)
        |----------------------------------------------------------------------
        */
        [
            'key'   => 'entry_into_care',
            'group' => 'Entry Into Care',
            'title' => 'Entry Into Care',
            'description' => 'How and why you came to be placed into care.',
            'evidence_categories' => ['social_care'],
            'questions' => [
                ['key' => 'how_placed', 'type' => 'long_text', 'label' => 'How did you come to be placed into care?'],
                ['key' => 'who_decided', 'type' => 'short_text', 'label' => 'Do you remember who made that decision?'],
                ['key' => 'told_why', 'type' => 'long_text', 'label' => 'Were you told why you were being taken into care?'],
                ['key' => 'placing_authority', 'type' => 'short_text', 'label' => 'Which placing authority or organisation placed you in care?'],
                ['key' => 'had_siblings', 'type' => 'boolean', 'label' => 'Did you have siblings?'],
                ['key' => 'split_from_siblings', 'type' => 'boolean', 'label' => 'Were you split from any siblings?'],
                ['key' => 'how_felt', 'type' => 'long_text', 'label' => 'How did you feel at the time?'],
                ['key' => 'dates_approximate', 'type' => 'boolean', 'label' => 'Are dates approximate (based on memory / family / records)?'],
            ],
        ],

        /*
        |----------------------------------------------------------------------
        | GROUP: Care Placements  (Template sections 3 & 4)
        |----------------------------------------------------------------------
        */
        [
            'key'   => 'placement_chronology',
            'group' => 'Care Placements',
            'title' => 'Care Placement Chronology',
            'description' => 'Every relevant care placement in chronological order.',
            'evidence_categories' => ['social_care', 'care_history'],
            'questions' => [
                [
                    'key' => 'placements', 'type' => 'repeater', 'label' => 'Placements',
                    'autofill' => 'claim.careSettings',
                    'fields' => [
                        ['key' => 'setting', 'type' => 'short_text', 'label' => 'Care setting / institution'],
                        ['key' => 'location', 'type' => 'short_text', 'label' => 'Location'],
                        ['key' => 'dates', 'type' => 'short_text', 'label' => 'Approx. dates'],
                        ['key' => 'age', 'type' => 'short_text', 'label' => 'Age'],
                        ['key' => 'placing_authority', 'type' => 'short_text', 'label' => 'Placing authority'],
                        ['key' => 'notes', 'type' => 'long_text', 'label' => 'Notes / source of information'],
                    ],
                ],
            ],
        ],
        [
            'key'   => 'placement_detail',
            'group' => 'Care Placements',
            'title' => 'Placement Detail',
            'description' => 'Daily life, staff, routines and conditions within the placements.',
            'evidence_categories' => ['neglect', 'social_care'],
            'questions' => [
                ['key' => 'daily_life', 'type' => 'long_text', 'label' => 'What was daily life like there?'],
                ['key' => 'building_routines', 'type' => 'long_text', 'label' => 'What were the building, dormitories, routines, schooling and religious practices like?'],
                ['key' => 'staff_treatment', 'type' => 'long_text', 'label' => 'How were staff, carers, teachers and other adults towards you?'],
                ['key' => 'rules_punishments', 'type' => 'long_text', 'label' => 'Were there rules, punishments, isolation, night checks or unsafe arrangements?'],
                ['key' => 'basic_care', 'type' => 'long_text', 'label' => 'What were food, clothing, hygiene, warmth, supervision and emotional support like?'],
                ['key' => 'how_felt_there', 'type' => 'long_text', 'label' => 'How did you feel while you were there?'],
            ],
        ],

        /*
        |----------------------------------------------------------------------
        | GROUP: Details of Abuse  (Template sections 5, 5A–5D, 6)
        |----------------------------------------------------------------------
        */
        [
            'key'   => 'abuse_overview',
            'group' => 'Details of Abuse',
            'title' => 'Abuse, Neglect & Harm Experienced',
            'description' => 'The abuse, neglect or harm experienced — in the client\'s own words.',
            'evidence_categories' => ['abuse', 'neglect', 'violence', 'trauma'],
            'questions' => [
                ['key' => 'anything_happened', 'type' => 'long_text', 'label' => 'Did anything happen that you now consider abuse, neglect or harm?', 'required' => true],
                ['key' => 'who_responsible', 'type' => 'long_text', 'label' => 'Who was responsible?'],
                ['key' => 'where_happened', 'type' => 'short_text', 'label' => 'Where did it happen?'],
                ['key' => 'when_happened', 'type' => 'multiselect', 'label' => 'When did it usually happen?', 'options' => ['Daytime', 'Night-time', 'Weekends', 'Bath time', 'Bedtime', 'School time', 'Visits', 'Punishment', 'Outings', 'Other']],
                ['key' => 'how_often', 'type' => 'short_text', 'label' => 'How often did it happen?'],
                ['key' => 'over_what_period', 'type' => 'short_text', 'label' => 'Over what period of time did it happen?'],
                ['key' => 'escalated', 'type' => 'long_text', 'label' => 'Did it escalate or change over time?'],
                ['key' => 'specific_examples', 'type' => 'long_text', 'label' => 'Can you recall any specific examples?'],
            ],
        ],
        [
            'key'   => 'abuse_sexual',
            'group' => 'Details of Abuse',
            'title' => 'Sexual Abuse Prompts (5A)',
            'description' => 'Sensitive prompts — record only as far as the client is comfortable.',
            'evidence_categories' => ['abuse'],
            'sensitive' => true,
            'questions' => [
                ['key' => 'uncomfortable_touch', 'type' => 'boolean', 'label' => 'Were you ever touched in a way that made you uncomfortable?'],
                ['key' => 'exposed_sexual', 'type' => 'boolean', 'label' => 'Did anyone expose you to sexual behaviour, comments or images?'],
                ['key' => 'pressured_activity', 'type' => 'boolean', 'label' => 'Were you made, pressured or forced to take part in sexual activity?'],
                ['key' => 'how_many_times', 'type' => 'short_text', 'label' => 'How many times did this happen?'],
                ['key' => 'multiple_perpetrators', 'type' => 'boolean', 'label' => 'Was there more than one perpetrator?'],
                ['key' => 'sexual_detail', 'type' => 'long_text', 'label' => 'Anything further you wish to record (in your own words).'],
            ],
        ],
        [
            'key'   => 'abuse_physical',
            'group' => 'Details of Abuse',
            'title' => 'Physical Abuse Prompts (5B)',
            'evidence_categories' => ['violence', 'abuse'],
            'sensitive' => true,
            'questions' => [
                ['key' => 'hit_harmed', 'type' => 'boolean', 'label' => 'Were you ever hit, assaulted or physically harmed?'],
                ['key' => 'excessive_punishment', 'type' => 'boolean', 'label' => 'Were punishments excessive or humiliating?'],
                ['key' => 'restrained', 'type' => 'boolean', 'label' => 'Were you restrained, locked in, force-fed or denied food/toilet access?'],
                ['key' => 'object_used', 'type' => 'short_text', 'label' => 'Was an object used (belt, stick, strap, etc.)?'],
                ['key' => 'injuries', 'type' => 'long_text', 'label' => 'Did you suffer bruising, cuts, broken bones or other injuries?'],
                ['key' => 'treatment_received', 'type' => 'long_text', 'label' => 'Did you receive medical treatment, or should you have?'],
            ],
        ],
        [
            'key'   => 'abuse_emotional',
            'group' => 'Details of Abuse',
            'title' => 'Emotional Abuse Prompts (5C)',
            'evidence_categories' => ['trauma', 'abuse'],
            'sensitive' => true,
            'questions' => [
                ['key' => 'threatened', 'type' => 'boolean', 'label' => 'Were you threatened with being moved, separated or punished?'],
                ['key' => 'told_worthless', 'type' => 'boolean', 'label' => 'Were you told you were bad, unwanted, worthless or to blame?'],
                ['key' => 'denied_contact', 'type' => 'boolean', 'label' => 'Were you denied family contact, visits, calls or personal belongings?'],
                ['key' => 'made_ashamed', 'type' => 'long_text', 'label' => 'Were you made to feel ashamed about your background, appearance, needs or behaviour?'],
                ['key' => 'humiliated', 'type' => 'long_text', 'label' => 'Were you humiliated, frightened, isolated or made to feel powerless?'],
            ],
        ],
        [
            'key'   => 'abuse_neglect',
            'group' => 'Details of Abuse',
            'title' => 'Neglect Prompts (5D)',
            'evidence_categories' => ['neglect'],
            'sensitive' => true,
            'questions' => [
                ['key' => 'enough_food', 'type' => 'boolean', 'label' => 'Were you given enough food and drink?'],
                ['key' => 'clean_clothes', 'type' => 'boolean', 'label' => 'Did you have clean, suitable clothes, bedding and toiletries?'],
                ['key' => 'able_to_wash', 'type' => 'boolean', 'label' => 'Were you able to wash, bathe and maintain hygiene?'],
                ['key' => 'home_safe', 'type' => 'boolean', 'label' => 'Was the home warm, clean, safe and properly supervised?'],
                ['key' => 'needs_ignored', 'type' => 'long_text', 'label' => 'Were medical, dental, mental-health or medication needs ignored?'],
                ['key' => 'felt_safe', 'type' => 'boolean', 'label' => 'Did you feel safe?'],
            ],
        ],
        [
            'key'   => 'people_involved',
            'group' => 'Details of Abuse',
            'title' => 'People Involved, Witnesses & Staff Knowledge',
            'evidence_categories' => ['abuse', 'safeguarding'],
            'questions' => [
                ['key' => 'who_involved', 'type' => 'long_text', 'label' => 'Who do you remember being involved in the abuse, neglect or harm?'],
                ['key' => 'identifying_details', 'type' => 'long_text', 'label' => 'Names, nicknames, roles, appearance, uniform, location — anything to help identify them?'],
                ['key' => 'their_role', 'type' => 'multiselect', 'label' => 'Were they…', 'options' => ['Staff', 'Carers', 'Foster carers', 'Older children', 'Residents', 'Visitors', 'Family members', 'Religious staff', 'Teachers', 'Social workers', 'Medical staff', 'Volunteers', 'Someone else']],
                ['key' => 'had_authority', 'type' => 'boolean', 'label' => 'Did they have authority or control over you?'],
                ['key' => 'other_children_affected', 'type' => 'boolean', 'label' => 'Were there other children affected?'],
                ['key' => 'staff_knew', 'type' => 'long_text', 'label' => 'Did staff or others know, or should they have known? Why?'],
            ],
        ],

        /*
        |----------------------------------------------------------------------
        | GROUP: Reporting the Abuse  (Template sections 7 & 8)
        |----------------------------------------------------------------------
        */
        [
            'key'   => 'disclosure_reporting',
            'group' => 'Reporting the Abuse',
            'title' => 'Disclosure, Reporting & Responses',
            'evidence_categories' => ['safeguarding', 'social_care'],
            'questions' => [
                ['key' => 'told_anyone', 'type' => 'boolean', 'label' => 'At the time, did you tell anyone about what was happening?'],
                ['key' => 'who_told', 'type' => 'short_text', 'label' => 'If yes, who did you tell?'],
                ['key' => 'what_happened_told', 'type' => 'long_text', 'label' => 'What happened when you told them?'],
                ['key' => 'response_to_disclosure', 'type' => 'multiselect', 'label' => 'Were you…', 'options' => ['Believed', 'Ignored', 'Punished', 'Threatened', 'Moved placement', 'Disbelieved']],
                ['key' => 'why_not_told', 'type' => 'long_text', 'label' => 'If you did not tell anyone, why not?'],
                ['key' => 'reported_police', 'type' => 'boolean', 'label' => 'Have you ever reported this to police or authorities?'],
                ['key' => 'why_never_reported', 'type' => 'long_text', 'label' => 'If never reported, what was the reason?'],
            ],
        ],
        [
            'key'   => 'movement_leaving',
            'group' => 'Reporting the Abuse',
            'title' => 'Movement Between Placements & Leaving Care',
            'evidence_categories' => ['social_care'],
            'questions' => [
                ['key' => 'moved_between', 'type' => 'boolean', 'label' => 'Did you move between different homes or settings?'],
                ['key' => 'reasons_explained', 'type' => 'boolean', 'label' => 'Were reasons for moves explained to you?'],
                ['key' => 'abuse_continued', 'type' => 'boolean', 'label' => 'Did the abuse continue elsewhere?'],
                ['key' => 'ran_away', 'type' => 'boolean', 'label' => 'Did you ever run away, try to leave or ask to be moved?'],
                ['key' => 'age_left_care', 'type' => 'short_text', 'label' => 'How old were you when you left care?'],
                ['key' => 'after_leaving', 'type' => 'long_text', 'label' => 'What were your circumstances after leaving care?'],
            ],
        ],

        /*
        |----------------------------------------------------------------------
        | GROUP: Impact on Life  (Template sections 9, 10 & 11)
        |----------------------------------------------------------------------
        */
        [
            'key'   => 'impact_childhood',
            'group' => 'Impact on Life',
            'title' => 'Impact on Childhood & Immediate Aftermath',
            'evidence_categories' => ['trauma', 'mental_health'],
            'questions' => [
                ['key' => 'affected_at_time', 'type' => 'long_text', 'label' => 'How did the abuse, neglect or harm affect you at the time?'],
                ['key' => 'behaviour_changed', 'type' => 'long_text', 'label' => 'Did your behaviour change during or after the placement?'],
                ['key' => 'changes_recorded', 'type' => 'boolean', 'label' => 'Were these changes recorded by social work, school, GP, police or others?'],
                ['key' => 'education_affected', 'type' => 'long_text', 'label' => 'How was your school or education affected?'],
                ['key' => 'relationships_affected', 'type' => 'long_text', 'label' => 'How were your relationships with family and friends affected?'],
            ],
        ],
        [
            'key'   => 'impact_adult',
            'group' => 'Impact on Life',
            'title' => 'Long-Term Impact on Adult Life',
            'evidence_categories' => ['mental_health', 'addiction', 'suicide', 'trauma'],
            'questions' => [
                ['key' => 'mental_health', 'type' => 'long_text', 'label' => 'How has this affected your mental health?'],
                ['key' => 'physical_health', 'type' => 'long_text', 'label' => 'How has this affected your physical health, pain, sleep or substance misuse?'],
                ['key' => 'relationships_adult', 'type' => 'long_text', 'label' => 'How has this affected your relationships, trust and parenting?'],
                ['key' => 'work_education', 'type' => 'long_text', 'label' => 'How has this affected your work, education, confidence and stability?'],
                ['key' => 'identity', 'type' => 'long_text', 'label' => 'How has this affected your identity, self-worth, shame or guilt?'],
                ['key' => 'triggers', 'type' => 'long_text', 'label' => 'Are there triggers, anniversaries, places or situations that still affect you?'],
                ['key' => 'life_might_have_been', 'type' => 'long_text', 'label' => 'What do you feel your life might have been like if this had not happened?'],
            ],
        ],
        [
            'key'   => 'support_treatment',
            'group' => 'Impact on Life',
            'title' => 'Support & Treatment',
            'evidence_categories' => ['mental_health', 'addiction'],
            'questions' => [
                ['key' => 'received_support', 'type' => 'boolean', 'label' => 'Have you received any support or treatment?'],
                ['key' => 'counselling', 'type' => 'boolean', 'label' => 'Have you ever received counselling or therapy?'],
                ['key' => 'diagnosis', 'type' => 'long_text', 'label' => 'Have you been diagnosed with any condition linked to what happened?'],
                ['key' => 'medication', 'type' => 'long_text', 'label' => 'Are you taking, or have you taken, any medication?'],
                ['key' => 'support_now', 'type' => 'boolean', 'label' => 'Are you receiving support now?'],
            ],
        ],

        /*
        |----------------------------------------------------------------------
        | GROUP: Supporting Evidence  (Template sections 12, 13 & 14)
        |----------------------------------------------------------------------
        */
        [
            'key'   => 'supporting_evidence',
            'group' => 'Supporting Evidence',
            'title' => 'Supporting & Indirect Evidence',
            'description' => 'Records, documents and witnesses that support the account. Exhibits are managed in the Exhibits panel.',
            'evidence_categories' => ['social_care', 'documentation_failure'],
            'questions' => [
                ['key' => 'records_available', 'type' => 'multiselect', 'label' => 'Do you have any records?', 'options' => ['GP', 'Social work', 'School', 'Care', "Children's hearing", 'Medical', 'Hospital', 'Police', 'Prison/probation', 'Counselling', 'Benefits', 'Housing', 'Legal']],
                ['key' => 'records_show', 'type' => 'long_text', 'label' => 'Do records show running away, injuries, behavioural change, complaints or placement moves?'],
                ['key' => 'photos_letters', 'type' => 'long_text', 'label' => 'Any photographs, letters, diaries, reports, inquiry evidence or institutional admissions?'],
                ['key' => 'supporting_witnesses', 'type' => 'long_text', 'label' => 'Can siblings, former residents, teachers or professionals provide a supporting statement?'],
                ['key' => 'records_missing', 'type' => 'boolean', 'label' => 'Are records incomplete, missing or unavailable due to the passage of time?'],
                ['key' => 'exhibits_to_include', 'type' => 'long_text', 'label' => 'Which extracts should be exhibited to this witness statement?'],
            ],
        ],
        [
            'key'   => 'previous_claims',
            'group' => 'Supporting Evidence',
            'title' => 'Previous Claims, Settlements or Decisions',
            'questions' => [
                ['key' => 'previous_claim', 'type' => 'boolean', 'label' => 'Have you ever made a previous claim, complaint or application about this abuse?'],
                ['key' => 'received_outcome', 'type' => 'long_text', 'label' => 'Did you receive any payment, apology, response, settlement or decision?'],
                ['key' => 'signed_waiver', 'type' => 'boolean', 'label' => 'Did you sign any waiver, settlement agreement or discharge?'],
                ['key' => 'has_correspondence', 'type' => 'boolean', 'label' => 'Do you have copies of any previous correspondence or decisions?'],
            ],
        ],
        [
            'key'   => 'why_applying',
            'group' => 'Supporting Evidence',
            'title' => 'Why You Are Applying to Redress',
            'questions' => [
                ['key' => 'why_applying', 'type' => 'long_text', 'label' => 'Why are you applying to the Scottish Redress Scheme?', 'required' => true],
                ['key' => 'what_hope_for', 'type' => 'long_text', 'label' => 'What would you like to come from telling your story?'],
                ['key' => 'acknowledgement_meaning', 'type' => 'long_text', 'label' => 'What would acknowledgement mean to you?'],
                ['key' => 'anything_else', 'type' => 'long_text', 'label' => 'Anything else you want Redress Scotland to understand?'],
            ],
        ],

        /*
        |----------------------------------------------------------------------
        | GROUP: Declaration  (Template section 15, checklist & statement of truth)
        |----------------------------------------------------------------------
        */
        [
            'key'   => 'closing_welfare',
            'group' => 'Declaration',
            'title' => 'Closing Questions & Welfare Check',
            'questions' => [
                ['key' => 'anything_to_add', 'type' => 'long_text', 'label' => 'Is there anything else you want to say about your experience?'],
                ['key' => 'parts_to_omit', 'type' => 'long_text', 'label' => 'Any parts you do not want included, or wording to handle carefully?'],
                ['key' => 'feeling_after', 'type' => 'short_text', 'label' => 'How are you feeling after going through this today?'],
                ['key' => 'safe_to_leave', 'type' => 'boolean', 'label' => 'Do you feel safe to leave the meeting or end the call?'],
                ['key' => 'support_contact', 'type' => 'short_text', 'label' => 'Is there anyone you can contact for support after this?'],
            ],
        ],
        [
            'key'   => 'declaration',
            'group' => 'Declaration',
            'title' => 'Statement of Truth / Declaration',
            'description' => 'The applicant confirms the statement is true to the best of their knowledge.',
            'questions' => [
                ['key' => 'reviewed_statement', 'type' => 'boolean', 'label' => 'Client has reviewed the statement and confirmed any amendments.'],
                ['key' => 'dates_flagged_approximate', 'type' => 'boolean', 'label' => 'Approximate dates and uncertain details are clearly identified as approximate.'],
                ['key' => 'chronological', 'type' => 'boolean', 'label' => 'Each placement is set out in chronological order.'],
                ['key' => 'statement_of_truth', 'type' => 'declaration', 'label' => 'I believe that the facts stated in this Witness Statement are true to the best of my knowledge and recollection.', 'required' => true],
                ['key' => 'signed_name', 'type' => 'short_text', 'label' => 'Signed (name)', 'autofill' => 'client.full_name'],
                ['key' => 'signed_date', 'type' => 'date', 'label' => 'Date'],
            ],
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Generation options
    |--------------------------------------------------------------------------
    |
    | Each option that can accompany a generated witness statement. `template`
    | references a ContactTemplate key (boilerplate text) or a pdfs/* view;
    | `permission` gates the option to a capability. The panel is driven from
    | this list — options with an unmet permission are hidden.
    |
    */
    'generation_options' => [
        ['key' => 'cover_letter', 'label' => 'Include witness statement cover letter', 'template' => 'witness_statement_cover_letter', 'default' => true],
        ['key' => 'send_post', 'label' => 'Send witness statement via post', 'permission' => 'print-queue.manage'],
        ['key' => 'send_email', 'label' => 'Send witness statement via email', 'permission' => 'communications.send.email'],
        ['key' => 'payment_authority', 'label' => 'Client payment authority form', 'requires' => 'claim.bankDetail'],
        ['key' => 'bacs_verification', 'label' => 'BACS and authenticity verification', 'requires' => 'claim.bankDetail'],
        ['key' => 'what_happens_next', 'label' => 'Include "What Happens Next" information', 'template' => 'client_welcome_email', 'default' => true],
    ],

    // Document type used for the generated statement (looked up / created by display_name).
    'document_type' => 'Witness Statement',

    // Statuses a witness statement workspace can hold.
    'statuses' => ['draft', 'in_review', 'ready', 'generated', 'approved'],
];
