package com.codenetworkz.blog.models;

import com.codenetworkz.blog.config.SlugGenerator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;

import jakarta.validation.constraints.Size;
import lombok.*;
import org.springframework.data.annotation.CreatedDate;


import java.time.LocalDateTime;


@Setter
@Getter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@MappedSuperclass
public class BaseModel {

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

    @CreatedDate
    @Column(updatable = false)
    private LocalDateTime createAt;

    @Size(max = 20)
    @Column(updatable = false, length = 20)
    private String createdBy;

    private LocalDateTime updateAt;

    @Size(max = 20)
    @Column(length = 20)
    private String updateBy;

    @JsonIgnore
    @Column(length = 1, nullable = false)
    private Status isDelete;

    private LocalDateTime deleteAt;

    @Column(length = 1, nullable = false)
    private Status isActive;

    private Status isApproved;

}
