prepareInstall:
    type: prepareInstall
    description: 'Prepare installation'

environmentAndFolders:
    type: install
    description: 'Check environment and create folders'

databaseConnect:
    type: install
    description: 'Set up database connection'
    arguments:
        databaseDriver:
            description: 'Database connection type'
            option: '--database-driver'
            type: select
            values:
                mysqli: 'MySQL connection'
                pdo_sqlite: 'SQLite connection'
                pdo_pgsql: 'PostgreSQL connection'
                mssql: 'MSSQL connection'
            value: '%env(TYPO3_INSTALL_DB_DRIVER)%'
            default: 'mysqli'

        databaseUserName:
            condition: 'databaseDriver != "pdo_sqlite"'
            description: 'User name for database server'
            option: '--database-user-name'
            type: string
            value: '%env(TYPO3_INSTALL_DB_USER)%'
            default: ''

        databaseUserPassword:
            condition: 'databaseDriver != "pdo_sqlite"'
            description: 'User password for database server'
            option: '--database-user-password'
            type: hidden
            value: '%env(TYPO3_INSTALL_DB_PASSWORD)%'
            default: ''

        databaseHostName:
            condition: 'databaseDriver != "pdo_sqlite"'
            description: 'Host name of database server'
            option: '--database-host-name'
            type: string
            value: '%env(TYPO3_INSTALL_DB_HOST)%'
            default: '127.0.0.1'

        databasePort:
            condition: 'databaseDriver != "pdo_sqlite"'
            description: 'TCP Port of database server'
            option: '--database-port'
            type: int
            value: '%env(TYPO3_INSTALL_DB_PORT)%'
            default: 3306

        databaseSocket:
            condition: 'databaseDriver != "pdo_sqlite"'
            description: 'Unix Socket to connect to'
            option: '--database-socket'
            type: string
            value: '%env(TYPO3_INSTALL_DB_UNIX_SOCKET)%'
            default: ''

databaseSelect:
    type: install
    description: 'Select database'
    arguments:
        useExistingDatabase:
            description: 'Use already existing database?'
            option: '--use-existing-database'
            type: bool
            value: '%env(TYPO3_INSTALL_DB_USE_EXISTING)%'
            default: false

        databaseName:
            description: 'Name of the database'
            option: '--database-name'
            type: string
            value: '%env(TYPO3_INSTALL_DB_DBNAME)%'

databaseData:
    type: install
    description: 'Set up database'
    arguments:
        adminUserName:
            description: 'Username of to be created administrative user account'
            option: '--admin-user-name'
            type: string
            value: '%env(TYPO3_INSTALL_ADMIN_USER)%'

        adminPassword:
            description: 'Password of to be created administrative user account'
            option: '--admin-password'
            type: hidden
            value: '%env(TYPO3_INSTALL_ADMIN_PASSWORD)%'

        siteName:
            description: 'Name of the TYPO3 site'
            option: '--site-name'
            type: string
            default: 'New TYPO3 Console site'
            value: '%env(TYPO3_INSTALL_SITE_NAME)%'

defaultConfiguration:
    type: install
    description: 'Set up configuration'
    arguments:
        siteSetupType:
            description: 'Specify the site setup type'
            option: '--site-setup-type'
            type: select
            values:
                'no': 'Do nothing'
                site: 'Create root page'
            value: '%env(TYPO3_INSTALL_SITE_SETUP_TYPE)%'
            default: 'no'
        siteBaseUrl:
            condition: 'siteSetupType == "site"'
            description: 'Specify the site base url'
            option: '--site-base-url'
            type: string
            default: '/'
            value: '%env(TYPO3_INSTALL_SITE_BASE_URL)%'

writeWebserverConfiguration:
    type: Helhum\Typo3Console\Install\Action\WriteWebServerConfigAction
    description: 'Set up web server configuration'
    arguments:
        webServerConfig:
            description: 'Specify the web server you want to write configuration for'
            type: select
            values:
                'none': 'Do not write any configuration files'
                apache: 'Create Apache .htaccess file'
                iis: 'Create Microsoft-IIS web.config file'
            value: '%env(TYPO3_INSTALL_WEB_SERVER_CONFIG)%'
            default: 'none'

extensionSetup:
    type: extensionSetup
    description: 'Set up extensions'
    commands:
        - command: 'database:updateschema'
        - command: 'extension:setup'
