import VectorType from '../enum/VectorType.js'
import Sign from '../Geometry/Sign.js'
import { floorplanService } from './FloorplanService'
import { Signs } from '../enum/UIEvents'


export default class SignService {
    constructor() {
        this.signs = null
    }
  
    createSign(position, geoType, vectorId,floor) {
        let sign = null
        switch (geoType) {
            case VectorType.Cigaret:
                sign = new Sign(position, vectorId, VectorType.Cigaret,floor)
                break
            case VectorType.FirePoint:
                sign = new Sign(position, vectorId, VectorType.FirePoint,floor)
                break
            case VectorType.LeftFootPrint:
                sign = new Sign(position, vectorId, VectorType.LeftFootPrint,floor)
                break
            case VectorType.RightFootPrint:
                sign = new Sign(position, vectorId, VectorType.RightFootPrint,floor)
                break
            case VectorType.LeftShoePrint:
                sign = new Sign(position, vectorId, VectorType.LeftShoePrint,floor)
                break
            case VectorType.RightShoePrint:
                sign = new Sign(position, vectorId, VectorType.RightShoePrint,floor)
                break
            case VectorType.FingerPrint:
                sign = new Sign(position, vectorId, VectorType.FingerPrint,floor)
                break
            case VectorType.DeadBody:
                sign = new Sign(position, vectorId, VectorType.DeadBody,floor)
                break
            case VectorType.BloodStain:
                sign = new Sign(position, vectorId, VectorType.BloodStain,floor)
                break
        }

        floorplanService.addSign(sign)
        return sign
    }

    isSign(geoType) {
        switch (geoType) {
            case VectorType.Cigaret:
                return true
            case VectorType.FirePoint:
                return true
            case VectorType.LeftFootPrint:
                return true
            case VectorType.RightFootPrint:
                return true
            case VectorType.LeftShoePrint:
                return true
            case VectorType.RightShoePrint:
                return true
            case VectorType.FingerPrint:
                return true
            case VectorType.DeadBody:
                return true
            case VectorType.BloodStain:
                return true
        }
        return false
    }

    setSignInfo(signInfo) {
        let sign = floorplanService.getSign(signInfo.vectorId)
        sign.vectorId = signInfo.vectorId
        sign.angle = signInfo.angle
        sign.scale = signInfo.scale
        sign.center = JSON.parse(JSON.stringify(signInfo.center))
    }
    
    getSign(name) {
        return this.signs[name]
    }
}

const signService = new SignService()
export { signService }