package cn.edu.whu.boot.allocation.controllers.dtos;

import java.util.Objects;

/**
 * 用于接收外业人员列表
 */
public class Worker {
    private Integer id;

    private String username;

    // 0: 采集人员
    // 1：审核人员
    private Integer role;

    private String geohash;

    private String geojson;

    public Worker() {
    }

    public Worker(Integer id, String username, Integer role) {
        this.id = id;
        this.username = username;
        this.role = role;
    }

    public Worker(Integer id, Integer role, String geohash) {
        this.id = id;
        this.role = role;
        this.geohash = geohash;
    }

    public Integer getId() {
        return id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getRole() {
        return role;
    }

    public void setRole(Integer role) {
        this.role = role;
    }

    /**
     * 是否为采集人员
     */
    public boolean isCollector() {
        return role.equals(0);
    }

    /**
     * 是否为审核人员
     */
    public boolean isInspector() {
        return role.equals(1);
    }

    public String getGeohash() {
        return geohash;
    }

    public void setGeohash(String geohash) {
        this.geohash = geohash;
    }

    public String getGeojson() {
        return geojson;
    }

    public void setGeojson(String geojson) {
        this.geojson = geojson;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Worker worker = (Worker) o;
        return Objects.equals(id, worker.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
