import type { InjectionKey, Ref } from 'vue'
import type { ElTable } from 'element-plus'
import type { CategoryProp } from '@/hooks/useCommon'
import type { Tree } from '@/views/account_center/sub_account/components/organization/organization-tree.vue'

interface LocationProp {
    province: string
    city: string
    district: string
    adcode: number
}
export interface Location {
    lng: number
    lat: number
}
export type Area = {
    location: Location
    address_components: any
}
export interface Pager<T = any> {
    page: number
    size: number
    count: number
    lists: T[]
    getLists: () => Promise<any>
}
export interface MapContext {
    isInited: Ref<boolean> //是否初始化
    tcMap: any
    address: Ref<any>
    originSelectData?: Ref<any>
    showDialog?: (payload: any) => void //传递几何坐标信息
    searchCommon: (payload: any) => void
    handleLocation: (row: any) => void //定位
    handleDelete: (id: number) => void //删除
    toggleRowSelection?: (selectData: any[]) => void
}
export const MAP_INJECTION_KEY: InjectionKey<MapContext> = Symbol()

export interface ChannelContext {
    channel: Ref<number>
    categoryLists: Ref<CategoryProp[]>
    selectObj?: Ref<Record<number, any[]>>
    handleSelectionChange?: (val: any) => void
}
export const CHANNEL_INJECTION_KEY: InjectionKey<ChannelContext> = Symbol()

export interface OrganizationContext {
    fetchOrganizationList: () => void
    setSelectedNode: (data: Tree) => void
}
export const ORGANIZATION_INJECTION_KEY: InjectionKey<OrganizationContext> = Symbol()
