import { KeydownType, type Options } from '@meta2d/core';
import { invert } from 'lodash-es';

//#region 点位
export enum MapPointType {
  普通点 = 1,
  等待点,
  避让点,
  临时避让点,

  电梯点 = 11,
  自动门点,
  充电点,
  停靠点,
  动作点,
  禁行点,
}
export const MAP_POINT_TYPES = Object.freeze(
  <[string, MapPointType][]>Object.entries(MapPointType).filter(([, v]) => typeof v === 'number'),
);
//#endregion

//#region 线路
export enum MapRouteType {
  直线 = 'line',
  二阶贝塞尔曲线 = 'bezier2',
  三阶贝塞尔曲线 = 'bezier3',
}
export const MAP_ROUTE_TYPE = invert(MapRouteType);
export const MAP_ROUTE_TYPES = Object.freeze(<[string, MapRouteType][]>Object.entries(MapRouteType));

export enum MapRoutePassType {
  无,
  仅空载可通行,
  仅载货可通行,
  禁行 = 10,
}
export const MAP_ROUTE_PASS_TYPES = Object.freeze(
  <[string, MapRoutePassType][]>Object.entries(MapRoutePassType).filter(([, v]) => typeof v === 'number'),
);
//#endregion

//#region 区域
export enum MapAreaType {
  库区 = 1,

  互斥区 = 11,
  非互斥区,
}
export const MAP_AREA_TYPES = Object.freeze(
  <[string, MapAreaType][]>Object.entries(MapAreaType).filter(([, v]) => typeof v === 'number'),
);
//#endregion

export const EDITOR_CONFIG: Options = {
  keydown: KeydownType.None,
  strictScope: true,
  moveConnectedLine: false,
  disableInput: true,
  disableRotate: true,
  disableSize: true,
  disableAnchor: true,
  disableEmptyLine: true,
  disableRepeatLine: true,
  minScale: 0.24,
  maxScale: 4.01,
  scaleOff: 0.01,
  defaultAnchors: [],
  globalAlpha: 0,
  activeGlobalAlpha: 0,
  fontSize: 14,
  lineHeight: 1.5,
  fontFamily: 'system-ui',
  textRotate: false,
  textAlign: 'center',
  textBaseline: 'top',
};
