package online.wesal.wesal.dto;

import online.wesal.wesal.entity.Post;
import online.wesal.wesal.entity.User;
import java.time.LocalDateTime;

public class PostResponseDTO {
    
    private String id;
    private CreatorDTO creator;
    private String body;
    private String likes;
    private String comments;
    private boolean liked;
    private LocalDateTime creationDate;
    
    public PostResponseDTO() {}
    
    public PostResponseDTO(Post post, User creator) {
        this.id = String.valueOf(post.getId());
        this.creator = new CreatorDTO(creator);
        this.body = post.getBody();
        this.likes = String.valueOf(post.getLikes());
        this.comments = String.valueOf(post.getComments());
        this.liked = false; // Default value, will be set by service
        this.creationDate = post.getCreationDate();
    }
    
    public PostResponseDTO(Post post, User creator, boolean liked) {
        this.id = String.valueOf(post.getId());
        this.creator = new CreatorDTO(creator);
        this.body = post.getBody();
        this.likes = String.valueOf(post.getLikes());
        this.comments = String.valueOf(post.getComments());
        this.liked = liked;
        this.creationDate = post.getCreationDate();
    }
    
    public String getId() {
        return id;
    }
    
    public void setId(String id) {
        this.id = id;
    }
    
    public CreatorDTO getCreator() {
        return creator;
    }
    
    public void setCreator(CreatorDTO creator) {
        this.creator = creator;
    }
    
    public String getBody() {
        return body;
    }
    
    public void setBody(String body) {
        this.body = body;
    }
    
    public String getLikes() {
        return likes;
    }
    
    public void setLikes(String likes) {
        this.likes = likes;
    }
    
    public String getComments() {
        return comments;
    }
    
    public void setComments(String comments) {
        this.comments = comments;
    }
    
    public boolean isLiked() {
        return liked;
    }
    
    public void setLiked(boolean liked) {
        this.liked = liked;
    }
    
    public LocalDateTime getCreationDate() {
        return creationDate;
    }
    
    public void setCreationDate(LocalDateTime creationDate) {
        this.creationDate = creationDate;
    }
}