{{!
    This file is part of Moodle - https://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template file/mod/backup/moodle2/backup_stepslib

    Activity backup/moodle2/backup_<modname>_stepslib.php file.

    Context variables required for this template:
    * component
    * copyright

    Example context (json):
    {
        "component": "local_test",
        "copyright": "2021 David Mudrák <david@moodle.com>"
    }
}}
{{< common/backup_php }}
{{$ description }}Backup steps for {{ component }} are defined here.{{/ description }}
{{$ package }}{{ component }}{{/ package }}
{{$ copyright }}{{ copyright }}{{/ copyright }}
{{/ common/backup_php }}

/**
 * Define the complete structure for backup, with file and id annotations.
 */
class backup_{{ component_name }}_activity_structure_step extends backup_activity_structure_step {

    /**
     * Defines the structure of the resulting xml file.
     *
     * @return backup_nested_element The structure wrapped by the common 'activity' element.
     */
    protected function define_structure() {
        $userinfo = $this->get_setting_value('userinfo');

        // Replace with the attributes and final elements that the element will handle.
        $attributes = null;
        $finalelements = null;
        $root = new backup_nested_element('{{ component }}', $attributes, $finalelements);
        {{# mod_features.backup_moodle2.backup_elements}}

        // Replace with the attributes and final elements that the element will handle.
        $attributes = null;
        $finalelements = null;
        ${{ .name }} = new backup_nested_element('{{ .name }}', $attributes, $finalelements);
        {{/ mod_features.backup_moodle2.backup_elements}}

        // Build the tree with these elements with $root as the root of the backup tree.

        // Define the source tables for the elements.

        // Define id annotations.

        // Define file annotations.

        return $this->prepare_activity_structure($root);
    }
}
