{
    "version": 1,
    "supportedProjectTypes": [ "UNKNOWN_PROJECT" ],
    "id": "J.Subversion",
    "category": "T.Import",
    "trDescription": "Checks out a Subversion repository and tries to load the contained project.",
    "trDisplayName": "Subversion Checkout",
    "trDisplayCategory": "Import Project",
    "icon": "icon.png",
    "enabled": "%{JS: value('Plugins').indexOf('Subversion') >= 0}",

    "options":
    [
        { "key": "vcsId", "value": "J.Subversion" },
        { "key": "vcsName", "value": "%{JS: Vcs.displayName('%{vcsId}')}" },
        { "key": "SR", "value": "%{JS: '%{Repo}'.replace(/[/]trunk$/, '').replace(/[/]$/, '') }"},
        { "key": "defaultDir", "value": "%{JS: '%{SR}'.substr('%{SR}'.lastIndexOf('/') + 1).replace(/[.]/g, '-') }"},
        { "key": "TargetPath", "value": "%{Path}/%{Dir}" }
    ],

    "pages":
    [
        {
            "trDisplayName": "Configuration",
            "trShortTitle": "Configuration",
            "trSubTitle": "Please configure <b>%{vcsName}</b> now.",
            "typeId": "VcsConfiguration",
            "enabled": "%{JS: !Vcs.isConfigured('%{vcsId}')}",
            "data": { "vcsId": "%{vcsId}" }
        },
        {
            "trDisplayName": "Location",
            "trShortTitle": "Location",
            "trSubTitle": "Specify repository URL, checkout directory, and path.",
            "typeId": "Fields",
            "data" :
            [
                {
                    "name": "Repo",
                    "trDisplayName": "Repository:",
                    "mandatory": true,
                    "type": "LineEdit",
                    "isComplete": "%{JS: Vcs.isValidRepoUrl('%{vcsId}', '%{Repo}')}",
                    "trIncompleteMessage": "Repository URL is not valid"
                },
                {
                    "name": "Sp1",
                    "type": "Spacer",
                    "data": { "factor": 2 }
                },
                {
                    "name": "Path",
                    "trDisplayName": "Path:",
                    "type": "PathChooser",
                    "data":
                    {
                        "kind": "existingDirectory",
                        "basePath": "%{InitialPath}",
                        "path": "%{InitialPath}"
                    }
                },
                {
                    "name": "Dir",
                    "trDisplayName": "Directory:",
                    "mandatory": true,
                    "type": "LineEdit",
                    "isComplete": "%{JS: '%{Dir}' === '' || !Util.exists('%{TargetPath}')}",
                    "trIncompleteMessage": "\"%{JS: Util.toNativeSeparators('%{TargetPath}')}\" exists in the filesystem.",
                    "data":
                    {
                        "trText": "%{defaultDir}"
                    }
                },
                {
                    "name": "TrustCert",
                    "trDisplayName": "Trust Server Certificate",
                    "type": "CheckBox",
                    "data":
                    {
                        "checkedValue": "--trust-server-cert",
                        "uncheckedValue": ""
                    }
                }
            ]
        },
        {
            "trDisplayName": "Checkout",
            "trShortTitle": "Checkout",
            "typeId": "VcsCommand",
            "data" :
            {
                "vcsId": "%{vcsId}",
                "trRunMessage": "Running Subversion checkout...",
                "repository": "%{Repo}",
                "baseDirectory": "%{Path}",
                "checkoutName": "%{Dir}",
                "extraArguments": [ "%{TrustCert}" ]
            }
        }
    ],

    "generators":
    [
        {
            "typeId": "Scanner",
            "data": {
                "subdirectoryPatterns": [ "^src$" ]
            }
        }
    ]
}
