package com.bizzan.bitrade.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import java.util.Date;

/**
 * APP首页Banner配置
 */
@Entity
@Data
@Table(name = "app_banner")
public class AppBanner {

    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Id
    private Long id;

    /**
     * Banner标题
     */
    private String title;

    /**
     * Banner图片地址
     */
    private String imageUrl;

    /**
     * 跳转类型: internal=APP内部页面, external=外部网页
     */
    private String linkType;

    /**
     * 跳转地址: internal时填URI(如/futures/BTCUSDT), external时填完整URL
     */
    private String linkUrl;

    /**
     * 排序值，越大越靠前
     */
    private Integer sort = 0;

    /**
     * 状态: 1=启用, 0=禁用
     */
    private Integer status = 1;

    /**
     * 生效开始时间（为空则不限制）
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date startTime;

    /**
     * 生效结束时间（为空则不限制）
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endTime;

    @CreationTimestamp
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @UpdateTimestamp
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;
}
