import { request } from '@vtx/utils';
import { useRequest } from 'ahooks';
const BaseService = {
    useBaseInfo: (id: string) => {
        const { data: baseInfoRes } = useRequest(
            () =>
                request.get('/cloud/jcss-reborn/facility/get', {
                    data: { id: id, coordType: 'bd09' },
                }),
            { refreshDeps: [id] },
        );
        const info = baseInfoRes?.data;
        const baseInfo = [
            {
                label: '设施类型',
                key: 'facilityClassName',
                value: info?.facilityClassName,
            },
            {
                label: '行政区划',
                key: 'divisionName',
                value: info?.divisionName,
            },
            {
                label: '管理单位',
                key: 'manageUnitName',
                value: info?.manageUnitName,
            },
            {
                label: '地址',
                key: 'address',
                value: info?.address,
            },
        ];
        const photos = info?.photoIds ? JSON.parse(info.photoIds) : [];
        return {
            baseInfo,
            photos
        };
    },
};

export { BaseService };
