import { defineStore } from 'pinia'
import { FLIGHT_PLAN } from '/@/stores/constant/cacheKey'
import { FlightPlan } from '/@/stores/interface'
import { postLogout } from '/@/api/frontend/user/index'
import { Local } from '/@/utils/storage'
import router from '../router'

export const applyForFlightPlan = defineStore('flightPlan', {
    state: (): FlightPlan => {
        return {
            id: 0,
            username: '',
            group_id: 0,
            user_id: 0,
            business_id: 0,
            type: 0,
            city: '',
            departure_point: '',
            range: 0,
            planned_height: 0,
            pilot: '',
            certificate: '',
            aerocraft_sn: '',
            aerocraft_img: '',
            mobile: '',
            start_time: '',
            finish_time: '',
            status: 0,
            createtime: '',
            updatetime: '',
        }
    },
    actions: {

        dataFill (state: FlightPlan) {
            this.$state = state
        },
    },
    persist: {
        key: FLIGHT_PLAN,
    },
})
