package com.sysu.admin.controller.lz.area;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.experimental.FieldNameConstants;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.locationtech.jts.geom.MultiPolygon;
import org.locationtech.jts.geom.Point;

import javax.persistence.*;

@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@FieldNameConstants(innerTypeName = "FIELDS")
@Table(name = "lz_area")
@Entity
@DynamicInsert
@DynamicUpdate
public class LzArea {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @Column()
    private String name;

    @Column
    private String color;

    @Transient
    private String wkt;

    @Transient
    private String pointWkt;

    @JSONField(serialize = false)
    @Column(name = "geom")
    private MultiPolygon geom;

    @JSONField(serialize = false)
    @Column(name = "center_point")
    private Point point;
}
