package com.izouma.dingdong.domain.backstage;

import com.izouma.dingdong.domain.BaseEntity;
import com.izouma.dingdong.enums.ComplaintType;
import com.izouma.dingdong.enums.Solution;
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.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import java.time.LocalDateTime;

@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Where(clause = "enabled = 1")
//@JsonIgnoreProperties(value = { "hibernateLazyInitializer"})
@ApiModel(value = "投诉表", description = "投诉表")
public class Complaint extends BaseEntity {
    @ApiModelProperty(value = "订单ID", name = "orderId")
    private Long orderId;

    //商家或骑手
    @ApiModelProperty(value = "投诉目标", name = "target")
    private ComplaintType target;

    @ApiModelProperty(value = "投诉内容", name = "type")
    private String type;

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

    @ApiModelProperty(value = "具体内容", name = "content")
    private String content;

    @ApiModelProperty(value = "是否解决", name = "resolve")
    private Boolean resolve = false;

    @ApiModelProperty(value = "投诉时间", name = "time")
    private LocalDateTime time;

    @Enumerated(EnumType.STRING)
    @ApiModelProperty(value = "解决方式")
    private Solution solution;

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