import VectorType from '../enum/VectorType.js'
import Arrow from '../Geometry/Arrow.js'
import { mathUtil } from '../MathUtil.js'
import { floorplanService } from './FloorplanService'
import Constant from '../Constant'

export default class ArrowService {
    constructor() {
    }
  
    createArrow(startPosition,endPosition,vectorId,floor) {
        const arrow = new Arrow(startPosition, endPosition,vectorId,floor)
        floorplanService.addArrow(arrow)
        return arrow
    }

    updateArrow(vectorId,newPosition,dir){
        const arrow = floorplanService.getArrow(vectorId)
        arrow.updatePoint(newPosition,dir)
    }

    setArrowInfo(arrowInfo) {
        let arrow = floorplanService.getArrow(arrowInfo.vectorId)
        arrow.vectorId = arrowInfo.vectorId
        arrow.startPoint = JSON.parse(JSON.stringify(arrowInfo.startPoint))
        arrow.endPoint = JSON.parse(JSON.stringify(arrowInfo.endPoint))
    }

    deleteArrow(arrowId, floorNum) {
        floorplanService.deleteArrow(arrowId, floorNum)
    }
}

const arrowService = new ArrowService()
export { arrowService }