package com.izouma.uwip.domain;

import com.izouma.uwip.annotations.Searchable;
import com.izouma.uwip.enums.DistrictLevel;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;

@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel("行政区域")
public class District extends AuditedEntity {
    @Id
    private Long id;

    @Column(length = 10)
    private String cityCode;

    @Searchable
    private String name;

    private double lat;

    private double lng;

    @Column(length = 20)
    @Enumerated(EnumType.STRING)
    private DistrictLevel level;

    private Long parent;

    private int childCount;

    private int cityCount;

    private int districtCount;

    private int streetCount;

    @Transient
    private Boolean leaf;
}
