package com.izouma.dingdong.domain.user;

import com.izouma.dingdong.domain.BaseEntity;
import com.izouma.dingdong.domain.merchant.Merchant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;

@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel(value = "我的收藏", description = "我的收藏")
public class MyCollection extends BaseEntity {
    @ApiModelProperty(value = "用户ID",name = "userId")
    private Long userId;

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

    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.DETACH)
    @JoinColumn(name = "merchantId", insertable = false, updatable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
    private Merchant merchant;
}
