package com.izouma.nineth.domain;

import com.izouma.nineth.annotations.Searchable;
import com.izouma.nineth.converter.StringArrayConverter;
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.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import java.time.LocalDateTime;
import java.util.List;

@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel("系列活动")
public class Activity extends BaseEntity {

    @Searchable
    private String name;

    private String cover;

    @Column(columnDefinition = "TEXT")
    @Convert(converter = StringArrayConverter.class)
    private List<String> detail;

    private int projectId;

    @ApiModelProperty("详情")
    @Column(columnDefinition = "TEXT")
    private String content;

    public Activity(Long id , String name, LocalDateTime createdAt) {
        super.setId(id);
        super.setCreatedAt(createdAt);
        this.name = name;
    }
}
