package com.artfess.rescue.external.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Author: wsf
 * @Description: 定位来源
 * @DateTime: 2025/4/17 11:20
 **/
@Getter
@AllArgsConstructor
public enum LocationSourceEnum {

    REGISTER_1212(1L, "1212登记", 3),
    INSPECTION(2L, "巡查", 2),
    ENFORCEMENT(3L, "执法部门", 6),
    DRIVER(4L, "车方", 5),
    CUSTOMER_SERVICE(5L, "12122客服", 3),
    SMS(6L, "短信定位", 9),
    TUNNEL_SCAN(7L, "隧道扫码登记", 10),
    PUBLIC_ACCOUNT(8L, "公众号登记", 11),
    APP(9L, "渝智行APP", 12),
    MINI_PROGRAM(10L, "小程序登记", 13),
    MONITOR(11L, "监控站登记", 14),
    CHANGAN(12L, "长安", 15),
    CENTER(13L, "总中心", 14),
    SECTION_SCAN(14L, "路段扫码登记", 16),
    POLICE(15L, "交巡警登记", 6);

    private final Long code;
    private final String name;
    private final Integer type;

    /**
     * 获取对应关系的code
     *
     * @param type type
     * @return code
     */
    public static Long getCodeByType(Integer type) {
        for (LocationSourceEnum e : values()) {
            if (e.getType().equals(type)) {
                return e.getCode();
            }
        }
        return 13L;
    }

    /**
     * 获取对应关系的type
     *
     * @param code code
     * @return Type
     */
    public static Integer getTypeByCode(Long code) {
        for (LocationSourceEnum e : values()) {
            if (e.getCode().equals(code)) {
                return e.getType();
            }
        }
        return null;
    }

}
