import L from "leaflet";

export const shadowHouseUrl = "/images/shadow-house.png";
export const guardedHouseUrl = "/images/guarded-house.png";
export const unguardedHouseUrl = "/images/unguarded-house.png";
export const alarmHouseUrl = "/images/alarm-house.png";
export const warningHouseUrl = "/images/warning-house.png";
export const offlineHouseUrl = "/images/offline-house.png";
export const disabledHouseUrl = "/images/disabled-house.png";

export const goodHouseUrl = "/images/good_asset_marker.png";
export const badHouseUrl = "/images/bad_asset_marker.png";

const size = 32;
const halfSize = size / 2;

const createIcon = (url: string, useAnimation: boolean = false) => {
	return L.icon({
		iconUrl: url,
		iconSize: [size, size],
		iconAnchor: [halfSize, halfSize],
		popupAnchor: [0, -halfSize],
		className: useAnimation ? "animation" : undefined,
	});
};

export const GuardedHouseIcon = createIcon(guardedHouseUrl);
export const UnguardedHouseIcon = createIcon(unguardedHouseUrl);
export const AlarmHouseIcon = createIcon(alarmHouseUrl, true);
export const WarningHouseIcon = createIcon(warningHouseUrl);
export const OfflineHouseIcon = createIcon(offlineHouseUrl);
export const DisabledHouseIcon = createIcon(disabledHouseUrl);

export const GoodHouseIcon = createIcon(goodHouseUrl);
export const BadHouseIcon = createIcon(badHouseUrl);
