package com.izouma.dingdong.domain.rider;

import com.izouma.dingdong.domain.BaseEntity;
import com.izouma.dingdong.domain.User;
import com.izouma.dingdong.enums.ApplyStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Where;

import javax.persistence.*;

@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Where(clause = "enabled = 1")
@ApiModel(value = "骑手", description = "骑手")
public class Rider extends BaseEntity {
    @ApiModelProperty(value = "用户ID", name = "userId")
    private Long userId;

    @ApiModelProperty(value = "工号", name = "jobNumber")
    private String jobNumber;

    @ApiModelProperty(value = "工作地点", name = "area")
    private String area;

    @ApiModelProperty(value = "经度", name = "longitude")
    private Double longitude;

    @ApiModelProperty(value = "纬度", name = "latitude")
    private Double latitude;

//    @ApiModelProperty(value = "签到", name = "signIn")
//    private Boolean signIn;

    @ApiModelProperty(value = "摩托车图片", name = "motorcycle")
    private String motorcycleImg;

    @ApiModelProperty(value = "车牌照片", name = "licensePlateImg")
    private String licensePlateImg;

    @ApiModelProperty(value = "驾照照片",name = "driverLicenseImg")
    private String driverLicenseImg;

    @Column(nullable = false)
    @ApiModelProperty(value = "黑名单", name = "blacklist")
    private Boolean blacklist;

    @Column(nullable = false)
    private Boolean enabled = true;

    @Enumerated(EnumType.STRING)
    @ApiModelProperty(value = "状态", name = "status")
    private ApplyStatus status;

    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.DETACH)
    @JoinColumn(name = "userId", insertable = false, updatable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
    private User user;

//    @ApiModelProperty(value = "准点率", name = "punctualityRate")
//    private Double punctualityRate;

//    @ApiModelProperty(value = "经验值", name = "experience")
//    private String experience;

//    @ApiModelProperty(value = "等级", name = "level")
//    private int level;

//    @ApiModelProperty(value = "成单数", name = "singular")
//    private int singular;

//    @ApiModelProperty(value = "累计距离", name = "distance")
//    private double distance;

//    @ApiModelProperty(value = "好评数", name = "goodReview")
//    private int goodReview;

//    @ApiModelProperty(value = "差评数", name = "badReview")
//    private int badReview;

//    @ApiModelProperty(value = "操作",name = "operate")
//    private String operate;
}
