package com.izouma.dingdong.domain.merchant;

import com.izouma.dingdong.domain.BaseEntity;
import com.izouma.dingdong.domain.backstage.Voice;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.io.Serializable;

@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Where(clause = "enabled = 1")
@ApiModel(value = "自动回复以及语音设置")
public class AutomaticResponse extends BaseEntity implements Serializable {

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

    @ApiModelProperty(value = "用户ID")
    private Long userId;

    @ApiModelProperty(value = "好评内容")
    public String goodContent;

    @ApiModelProperty(value = "差评内容")
    private String badContent;

    @ApiModelProperty(value = "语音ID")
    private Long voiceId;

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

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