package kz.konturai.parser.model;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.time.LocalDateTime;

@Document(collection = "social_media_credentials")
public class SocialMediaCredentials {

    @Id
    private String id;

    @Field("user_id")
    private String userId;

    @Field("platform")
    private String platform; // "facebook", "instagram", etc.

    @Field("encrypted_credentials")
    private Object encryptedCredentials;

    @Field("ad_account_id")
    private String adAccountId;

    @Field("page_id")
    private String pageId;

    @Field("created_at")
    private LocalDateTime createdAt;

    @Field("updated_at")
    private LocalDateTime updatedAt;

    public SocialMediaCredentials() {
        this.createdAt = LocalDateTime.now();
        this.updatedAt = LocalDateTime.now();
    }

    public SocialMediaCredentials(String userId, String platform, Object encryptedCredentials) {
        this();
        this.userId = userId;
        this.platform = platform;
        this.encryptedCredentials = encryptedCredentials;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getPlatform() {
        return platform;
    }

    public void setPlatform(String platform) {
        this.platform = platform;
    }

    public Object getEncryptedCredentials() {
        return encryptedCredentials;
    }

    public void setEncryptedCredentials(Object encryptedCredentials) {
        this.encryptedCredentials = encryptedCredentials;
        this.updatedAt = LocalDateTime.now();
    }

    public String getAdAccountId() {
        return adAccountId;
    }

    public void setAdAccountId(String adAccountId) {
        this.adAccountId = adAccountId;
        this.updatedAt = LocalDateTime.now();
    }

    public String getPageId() {
        return pageId;
    }

    public void setPageId(String pageId) {
        this.pageId = pageId;
        this.updatedAt = LocalDateTime.now();
    }

    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;
    }
}
