function makeDrivingScenarioSettings()
% NOTE: This source code does not need to ship with the product.
% This code is used to generate the factory file which is placed
% in the resources folder for this toolbox. If this source code
% is modified, it must be executed and the generated factory file
% must be checked in. The generated factory file must be shipped
% with the product.

%   Copyright 2023 The MathWorks, Inc.

% define the tree structure and set the factory values
tree = createTree();

% create the SettingsFileUpgraders which modify user settings
% during an upgrade
upgraders = createUpgraders();

% write the factory file to the resources directory
factoryFile = fullfile(matlabroot, 'toolbox', 'shared', 'drivingscenario', 'resources', 'drivingscenario');
matlab.settings.internal.saveFactoryFile(factoryFile, tree, upgraders);
end

function dsTree = createTree()

dsTree = matlab.settings.FactoryGroup.createToolboxGroup("drivingscenario","Hidden",false);

% Add settings for driving scenarios
dsApp = dsTree.addGroup("actors","Hidden",false);
dsApp.addSetting("DefaultClassIDToAssetTypeMapping", ...
    "FactoryValue", dictionary(0:4,["Unspecified",...
    "Sedan","BoxTruck","Bicycle","MalePedestrian"]), ...
    "Hidden", false,...
    "ValidationFcn", @driving.scenario.internal.mustBeAssetDictionary);
dsApp.addSetting("DefaultClassIDToAssetPathMapping", ...
    "FactoryValue", dictionary(0:4,["Assets/Vehicles/Cuboid.rrvehicle","Assets/Vehicles/ADT Vehicles/SK_Sedan.fbx",...
    "Assets/Vehicles/ADT Vehicles/SK_BoxTruck.fbx","Assets/Vehicles/Cuboid.rrvehicle",...
    "Assets/Characters/Citizen_Male.rrchar"]), ...
    "Hidden", false,...
    "ValidationFcn", @driving.scenario.internal.mustBeAssetDictionary);
end

function upgraders = createUpgraders()
% No upgraders are necessary yet.
% May need to implement if the factory settings are modified
% in a way that creates an incompatibility
upgraders = matlab.settings.SettingsFileUpgrader("v1");
end


