package com.social.media.dto;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

import java.time.LocalDateTime;
import java.util.List;

public class PostDto {
    
    private Long id;
    private String postCode;
    
    @NotNull(message = "Company ID é obrigatório")
    private Long companyId;
    
    @NotNull(message = "Author ID é obrigatório")
    private Long authorId;
    
    private Long categoryId;
    
    @NotBlank(message = "Conteúdo é obrigatório")
    @Size(max = 65535, message = "Conteúdo deve ter no máximo 65535 caracteres")
    private String contentText;
    
    private String postType;
    private String status;
    private LocalDateTime scheduledFor;
    private LocalDateTime publishedAt;
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;
    private String tags;
    private Boolean isPinned;
    private Integer viewCount;
    private Integer likeCount;
    private Integer shareCount;
    private Integer commentCount;
    private LocalDateTime deletedAt;
    
    // Legacy fields for backward compatibility
    private String platform;
    private LocalDateTime scheduledAt;
    private List<String> mediaUrls;
    private List<String> hashtags;
    private PostMetricsDto metrics;
    
    public PostDto() {}
    
    public PostDto(Long id, String contentText, String postType, String status) {
        this.id = id;
        this.contentText = contentText;
        this.postType = postType;
        this.status = status;
        this.createdAt = LocalDateTime.now();
    }
    
    public PostDto(Long companyId, Long authorId, String contentText) {
        this.companyId = companyId;
        this.authorId = authorId;
        this.contentText = contentText;
        this.createdAt = LocalDateTime.now();
    }
    
    public static class PostMetricsDto {
        private Integer likes;
        private Integer comments;
        private Integer shares;
        private Integer views;
        private Double engagement;
        
        public PostMetricsDto() {}
        
        public PostMetricsDto(Integer likes, Integer comments, Integer shares, Integer views, Double engagement) {
            this.likes = likes;
            this.comments = comments;
            this.shares = shares;
            this.views = views;
            this.engagement = engagement;
        }
        
        // Getters e Setters
        public Integer getLikes() { return likes; }
        public void setLikes(Integer likes) { this.likes = likes; }
        
        public Integer getComments() { return comments; }
        public void setComments(Integer comments) { this.comments = comments; }
        
        public Integer getShares() { return shares; }
        public void setShares(Integer shares) { this.shares = shares; }
        
        public Integer getViews() { return views; }
        public void setViews(Integer views) { this.views = views; }
        
        public Double getEngagement() { return engagement; }
        public void setEngagement(Double engagement) { this.engagement = engagement; }
    }
    
    // Getters e Setters
    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }
    
    public String getPostCode() { return postCode; }
    public void setPostCode(String postCode) { this.postCode = postCode; }
    
    public Long getCompanyId() { return companyId; }
    public void setCompanyId(Long companyId) { this.companyId = companyId; }
    
    public Long getAuthorId() { return authorId; }
    public void setAuthorId(Long authorId) { this.authorId = authorId; }
    
    public Long getCategoryId() { return categoryId; }
    public void setCategoryId(Long categoryId) { this.categoryId = categoryId; }
    
    public String getContentText() { return contentText; }
    public void setContentText(String contentText) { this.contentText = contentText; }
    
    public String getPostType() { return postType; }
    public void setPostType(String postType) { this.postType = postType; }
    
    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }
    
    public LocalDateTime getScheduledFor() { return scheduledFor; }
    public void setScheduledFor(LocalDateTime scheduledFor) { this.scheduledFor = scheduledFor; }
    
    public LocalDateTime getPublishedAt() { return publishedAt; }
    public void setPublishedAt(LocalDateTime publishedAt) { this.publishedAt = publishedAt; }
    
    public LocalDateTime getCreatedAt() { return createdAt; }
    public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
    
    public LocalDateTime getUpdatedAt() { return updatedAt; }
    public void setUpdatedAt(LocalDateTime updatedAt) { this.updatedAt = updatedAt; }
    
    public String getTags() { return tags; }
    public void setTags(String tags) { this.tags = tags; }
    
    public Boolean getIsPinned() { return isPinned; }
    public void setIsPinned(Boolean isPinned) { this.isPinned = isPinned; }
    
    public Integer getViewCount() { return viewCount; }
    public void setViewCount(Integer viewCount) { this.viewCount = viewCount; }
    
    public Integer getLikeCount() { return likeCount; }
    public void setLikeCount(Integer likeCount) { this.likeCount = likeCount; }
    
    public Integer getShareCount() { return shareCount; }
    public void setShareCount(Integer shareCount) { this.shareCount = shareCount; }
    
    public Integer getCommentCount() { return commentCount; }
    public void setCommentCount(Integer commentCount) { this.commentCount = commentCount; }
    
    public LocalDateTime getDeletedAt() { return deletedAt; }
    public void setDeletedAt(LocalDateTime deletedAt) { this.deletedAt = deletedAt; }
    
    // Legacy getters/setters for backward compatibility
    public String getContent() { return contentText; }
    public void setContent(String content) { this.contentText = content; }
    
    public String getPlatform() { return platform; }
    public void setPlatform(String platform) { this.platform = platform; }
    
    public LocalDateTime getScheduledAt() { return scheduledFor; }
    public void setScheduledAt(LocalDateTime scheduledAt) { this.scheduledFor = scheduledAt; }
    
    public List<String> getMediaUrls() { return mediaUrls; }
    public void setMediaUrls(List<String> mediaUrls) { this.mediaUrls = mediaUrls; }
    
    public List<String> getHashtags() { return hashtags; }
    public void setHashtags(List<String> hashtags) { this.hashtags = hashtags; }
    
    public PostMetricsDto getMetrics() { return metrics; }
    public void setMetrics(PostMetricsDto metrics) { this.metrics = metrics; }
}
