package com.backendsys.modules.cms.page.entity;

import com.backendsys.modules.cms.article.entity.ArticleCategory;
import com.backendsys.modules.cms.article.entity.ArticleCategoryI18n;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import java.util.List;

@Data
@TableName("cms_page")
public class Page {

    public static interface Detail{}
    public static interface Create{}
    public static interface Update{}
    public static interface Delete{}

    @TableField(exist = false)
    private String lang;

    @TableId(type = IdType.AUTO)
    private Long id;

    @NotEmpty(message="内容标识不能为空", groups = { Create.class, Update.class, Delete.class, Detail.class })
    private String page_sign;

    @TableField(exist = false)
    private String title;
    @TableField(exist = false)
    private String description;
    @TableField(exist = false)
    private String content;
    @TableField(exist = false)
    private String meta_keyword;
    @TableField(exist = false)
    private String meta_description;

    @Range(min = 1, max = 9999, message = "排序必须在 {min} 到 {max} 之间", groups = { Create.class, Update.class })
    private Integer sort;

    @TableField(exist = false)
    @NotEmpty(message="内容不能为空", groups = { Create.class, Update.class})
    private List<PageI18n> translations;

    private String create_time;
    private String update_time;

}
