package com.qaup.system.domain;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.qaup.common.annotation.Excel;
import com.qaup.common.core.domain.BaseEntity;

/**
 * 车辆信息对象 sys_vehicle_info
 * 
 * @author tellme
 * @date 2025-07-01
 */
public class SysVehicleInfo extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 车辆ID */
    @Excel(name = "车辆ID")
    private Long vehicleId;

    /** 车牌号 */
    @Excel(name = "车牌号")
    private String licensePlate;

    /** VIN码 */
    private String vinNumber;


    /** 路径编码（新增，支持路径编码模式） */
    @Excel(name = "车辆类型编码")
    private String typeCode;

    /** 车辆类型名称（查询时关联获取，不存储） */
    private String typeName;

    /** 车辆类型显示名称（查询时关联获取，不存储） */
    private String typeDisplayName;

    /** 品牌 */
    @Excel(name = "品牌")
    private String brand;

    /** 所属单位 */
    @Excel(name = "所属单位")
    private String owningUnit;

    /** 联系人 */
    @Excel(name = "联系人")
    private String contactPerson;

    /** 电话 */
    @Excel(name = "电话")
    private String phoneNumber;

    /** 图片URL */
    @Excel(name = "图片URL")
    private String imageUrl;

    public void setVehicleId(Long vehicleId) 
    {
        this.vehicleId = vehicleId;
    }

    public Long getVehicleId() 
    {
        return vehicleId;
    }

    public void setLicensePlate(String licensePlate) 
    {
        this.licensePlate = licensePlate;
    }

    public String getLicensePlate() 
    {
        return licensePlate;
    }

    public void setVinNumber(String vinNumber) 
    {
        this.vinNumber = vinNumber;
    }

    public String getVinNumber() 
    {
        return vinNumber;
    }


    public void setTypeCode(String typeCode) 
    {
        this.typeCode = typeCode;
    }

    public String getTypeCode() 
    {
        return typeCode;
    }

    public void setTypeName(String typeName) 
    {
        this.typeName = typeName;
    }

    public String getTypeName() 
    {
        return typeName;
    }

    public void setTypeDisplayName(String typeDisplayName) 
    {
        this.typeDisplayName = typeDisplayName;
    }

    public String getTypeDisplayName() 
    {
        return typeDisplayName;
    }

    public void setBrand(String brand) 
    {
        this.brand = brand;
    }

    public String getBrand() 
    {
        return brand;
    }

    public void setOwningUnit(String owningUnit) 
    {
        this.owningUnit = owningUnit;
    }

    public String getOwningUnit() 
    {
        return owningUnit;
    }

    public void setContactPerson(String contactPerson) 
    {
        this.contactPerson = contactPerson;
    }

    public String getContactPerson() 
    {
        return contactPerson;
    }

    public void setPhoneNumber(String phoneNumber) 
    {
        this.phoneNumber = phoneNumber;
    }

    public String getPhoneNumber() 
    {
        return phoneNumber;
    }

    public void setImageUrl(String imageUrl) 
    {
        this.imageUrl = imageUrl;
    }

    public String getImageUrl() 
    {
        return imageUrl;
    }

    /**
     * 业务方法：获取一级分类编码
     */
    public String getTopLevelTypeCode() {
        if (typeCode == null || typeCode.trim().isEmpty()) {
            return null;
        }
        
        int dotIndex = typeCode.indexOf('.');
        if (dotIndex > 0) {
            return typeCode.substring(0, dotIndex);
        }
        return typeCode;
    }

    /**
     * 业务方法：判断是否为无人车
     */
    public boolean isUnmannedVehicle() {
        return "UV".equals(getTopLevelTypeCode());
    }

    /**
     * 业务方法：判断是否为特勤车
     */
    public boolean isSpecialVehicle() {
        return "SP".equals(getTopLevelTypeCode());
    }

    /**
     * 业务方法：判断是否为普通车
     */
    public boolean isNormalVehicle() {
        return "NM".equals(getTopLevelTypeCode());
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("vehicleId", getVehicleId())
            .append("licensePlate", getLicensePlate())
            .append("vinNumber", getVinNumber())
            .append("typeCode", getTypeCode())
            .append("typeName", getTypeName())
            .append("typeDisplayName", getTypeDisplayName())
            .append("brand", getBrand())
            .append("owningUnit", getOwningUnit())
            .append("contactPerson", getContactPerson())
            .append("phoneNumber", getPhoneNumber())
            .append("imageUrl", getImageUrl())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("remark", getRemark())
            .toString();
    }
}
