<script setup>
import { useConfigStore } from '@/stores/config.js'

const conf = useConfigStore().config
const branch = ref(null)
const mirror = ref(null)

const steps = computed(() => [
  {
    title: '更新源码',
    command: ['fetch', 'switch', 'reset'],
    cwd: 'mower-ng'
  },
  {
    title: '安装依赖',
    command: ['pip_install'],
    cwd: 'mower-ng'
  }
])
provide('steps', steps)
const current_step = ref(1)
provide('current_step', current_step)
const current_state = ref('wait')
provide('current_state', current_state)
</script>

<template>
  <n-flex vertical style="gap: 16px; height: 100%; padding: 16px; box-sizing: border-box">
    <n-form label-placement="left" :show-feedback="false" label-width="auto" label-align="left">
      <n-form-item label="mower-ng 代码分支">
        <n-radio-group v-model:value="conf.branch">
          <n-flex>
            <n-radio value="fast">测试版</n-radio>
            <n-radio value="slow">稳定版</n-radio>
          </n-flex>
        </n-radio-group>
      </n-form-item>
      <n-form-item label="PyPI 仓库镜像">
        <n-radio-group v-model:value="conf.mirror">
          <n-flex>
            <n-radio value="pypi">PyPI</n-radio>
            <n-radio value="aliyun">阿里云镜像站</n-radio>
            <n-radio value="sjtu">上海交通大学镜像站</n-radio>
            <n-radio value="tuna">清华大学镜像站</n-radio>
          </n-flex>
        </n-radio-group>
      </n-form-item>
    </n-form>
    <n-steps :current="current_step" :status="current_state" size="small">
      <n-step v-for="step in steps" :title="step.title" />
    </n-steps>
    <log-component />
  </n-flex>
  <float-button />
</template>
