package com.izouma.dingdong.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.time.LocalDateTime;

@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Where(clause = "enabled = 1")
@ApiModel(value = "评价表", description = "评价表")
public class Appraisal extends BaseEntity {
    @ApiModelProperty(value = "订单号", name = "orderId")
    private Long orderInfoId;

    @ApiModelProperty(value = "商户ID", name = "merchantId")
    private Long merchantId;

    @ApiModelProperty(value = "骑手工号", name = "riderId")
    private Long riderId;

    @ApiModelProperty(value = "图片", name = "img")
    private String img;


    /**
     * true 好评，false 差评
     */
    @Column(nullable = false)
    @ApiModelProperty(value = "商品评分", name = "goodsScore")
    private Boolean goodsLike = true ;

    @ApiModelProperty(value = "商品评价", name = "goodsAppraise")
    private String goodsAppraise;

    /**
     * 1-非常差，2-一般，3-超赞
     */
    @ApiModelProperty(value = "骑手评分", name = "riderScore")
    private Integer riderLike;

    @ApiModelProperty(value = "骑手评价", name = "riderAppraise")
    private String riderAppraise;

/*    @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.DETACH)
    @JoinColumn(name = "orderInfoId", insertable = false, updatable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
    private OrderInfo order;*/

    @ApiModelProperty(value = "商家回复评价", name = "merchantReply")
    private String merchantReply;

    @ApiModelProperty(value = "评价日期", name = "appreiseTime")
    private LocalDateTime appraiseTime;

    @ApiModelProperty(value = "点赞数")
    private Integer likes;

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