/** 城市管理假数据，接口就绪后替换 */

export const CITY_STATUS_MAP = {
	opened: { label: '已开通', class: 'opened' },
	pending: { label: '审核中', class: 'pending' },
	rejected: { label: '审核驳回', class: 'rejected' },
}

export const MOCK_CITY_RECORDS = [
	{
		id: '1',
		centerName: '北京朝阳-望京运营中心',
		status: 'opened',
		reason: '暂无',
		openTime: '2025.02.01 12:00:46',
	},
	{
		id: '2',
		centerName: '太原小店-长风运营中心',
		status: 'pending',
		reason: '拓展业务区域',
		openTime: '2025.03.10 14:20:00',
	},
	{
		id: '3',
		centerName: '西安雁塔-高新运营中心',
		status: 'rejected',
		reason: '申请开通新店',
		openTime: '2025.02.15 09:00:00',
	},
]

/** 省 / 市 / 运营中心 级联假数据 */
export const PROVINCE_CITY_TREE = [
	{
		name: '北京市',
		cities: [
			{
				name: '北京市',
				centers: [
					{ id: 'bj1', name: '北京朝阳-望京运营中心' },
					{ id: 'bj2', name: '北京海淀-中关村运营中心' },
				],
			},
		],
	},
	{
		name: '山西省',
		cities: [
			{
				name: '太原市',
				centers: [
					{ id: 'ty1', name: '太原小店-长风运营中心' },
					{ id: 'ty2', name: '太原万柏林-信达运营中心' },
				],
			},
		],
	},
	{
		name: '陕西省',
		cities: [
			{
				name: '西安市',
				centers: [
					{ id: 'xa1', name: '西安雁塔-高新运营中心' },
					{ id: 'xa2', name: '西安未央-凤城运营中心' },
				],
			},
		],
	},
]

export function getCitiesByProvince(provinceName) {
	const province = PROVINCE_CITY_TREE.find(p => p.name === provinceName)
	return province ? province.cities : []
}

export function getCentersByCity(provinceName, cityName) {
	const cities = getCitiesByProvince(provinceName)
	const city = cities.find(c => c.name === cityName)
	return city ? city.centers : []
}
