/**
* Google Apps Script to create the "Saving the Irish Salmon – Policy 2025 Survey" in Google Forms.
* Usage:
* 1) Go to script.google.com -> New project.
* 2) Replace the default Code.gs with this entire script.
* 3) Click Run > Run function > createSalmonSurvey.
* 4) Authorize when prompted. The script will log the Form URL.
*/

function createSalmonSurvey() {
var form = FormApp.create('Saving the Irish Salmon – Policy 2025 Survey')
.setDescription('This survey seeks feedback on the proposals outlined in "Saving the Irish Salmon – Salmon Watch Ireland Policy Statement 2025". Your responses will help guide advocacy, conservation, and policy engagement.');

// ---- Section 1 – About You ----
form.addPageBreakItem().setTitle('Section 1 – About You');

form.addMultipleChoiceItem()
.setTitle('Q1. What best describes your background?')
.setChoiceValues([
'Angler',
'Fishery owner/manager',
'Conservation NGO',
'Government/agency representative',
'General public',
'Other (please specify below)'
])
.setRequired(true);

form.addParagraphTextItem()
.setTitle('If "Other", please specify')
.setRequired(false);

form.addScaleItem()
.setTitle('Q2. How familiar are you with the issues affecting wild Atlantic salmon in Ireland?')
.setBounds(1, 5)
.setLabels('1 = Not at all familiar', '5 = Very familiar')
.setRequired(true);

// ---- Section 2 – Policy Proposals ----
form.addPageBreakItem().setTitle('Section 2 – Policy Proposals');

// Likert grid: Strongly Agree → Strongly Disagree
form.addGridItem()
.setTitle('Q3. Please indicate your level of agreement with the following proposals:')
.setRows([
'Shift policy from exploitation to conservation',
'Integrate salmon conservation into climate adaptation strategies',
'Remove obsolete river barriers and modernise hydro schemes',
'End commercial net fishing (with fair compensation)',
'Phase out open-net salmon farming',
'Reform Salmon Conservation Fund',
'Support local river trusts and community projects',
'Strengthen fisheries law and enforcement',
'Increase international cooperation (NASCO, etc.)'
])
.setColumns([
'Strongly Agree',
'Agree',
'Neutral',
'Disagree',
'Strongly Disagree'
])
.setRequired(true);

// ---- Section 3 – Priorities ----
form.addPageBreakItem().setTitle('Section 3 – Priorities');

// Note: Google Forms does not natively enforce "max 3" selections for checkboxes.
// Add clear instruction; optionally split into separate ranked questions.
form.addCheckboxItem()
.setTitle('Q4. Which three actions are most urgent for protecting wild salmon? (Select up to 3)')
.setChoices([
form.createChoice('Habitat restoration'),
form.createChoice('Barrier removal'),
form.createChoice('Fisheries enforcement'),
form.createChoice('Ending open-net aquaculture'),
form.createChoice('Climate adaptation'),
form.createChoice('Predator management'),
form.createChoice('Reform conservation funding'),
form.createChoice('Other (please specify below)')
])
.setRequired(true)
.setHelpText('Please select no more than three (manual limit).');

form.addParagraphTextItem()
.setTitle('If "Other", please specify')
.setRequired(false);

form.addParagraphTextItem()
.setTitle('Q5. What barriers do you see to effective salmon conservation in Ireland?')
.setRequired(false);

// ---- Section 4 – Engagement ----
form.addPageBreakItem().setTitle('Section 4 – Engagement');

form.addCheckboxItem()
.setTitle('Q6. Would you be interested in supporting Salmon Watch Ireland’s work through:')
.setChoices([
form.createChoice('Volunteering'),
form.createChoice('Community initiatives'),
form.createChoice('Policy advocacy'),
form.createChoice('Financial support'),
form.createChoice('Not at this time')
])
.setRequired(false);

form.addParagraphTextItem()
.setTitle('Q7. Any additional comments or suggestions?')
.setRequired(false);

form.setConfirmationMessage('Thank you for completing this survey. Your feedback will help shape future efforts to protect Ireland’s wild Atlantic salmon.');

Logger.log('Form created: ' + form.getEditUrl());
Logger.log('Send this URL to respondents: ' + form.getPublishedUrl());
}