package com.petshop.backend.dto.chat;

import com.petshop.backend.entity.Conversation;

import java.time.LocalDateTime;

public class ConversationResponse {
    private Long id;
    private Long customerId;
    private Long staffId;
    private String status;
    private String mode;
    private String lastMessage;
    private Long lastSenderId;
    private LocalDateTime humanRequestedAt;
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;

    public ConversationResponse() {
    }

    public ConversationResponse(Long id, Long customerId, Long staffId, String status, String mode, String lastMessage, Long lastSenderId, LocalDateTime humanRequestedAt, LocalDateTime createdAt, LocalDateTime updatedAt) {
        this.id = id;
        this.customerId = customerId;
        this.staffId = staffId;
        this.status = status;
        this.mode = mode;
        this.lastMessage = lastMessage;
        this.lastSenderId = lastSenderId;
        this.humanRequestedAt = humanRequestedAt;
        this.createdAt = createdAt;
        this.updatedAt = updatedAt;
    }

    public static ConversationResponse fromEntity(Conversation conversation, String lastMessage, Long lastSenderId) {
        ConversationResponse response = new ConversationResponse();
        response.setId(conversation.getId());
        response.setCustomerId(conversation.getCustomerId());
        response.setStaffId(conversation.getStaffId());
        response.setStatus(conversation.getStatus().name());
        response.setMode(conversation.getMode().name());
        response.setLastMessage(lastMessage);
        response.setLastSenderId(lastSenderId);
        response.setHumanRequestedAt(conversation.getHumanRequestedAt());
        response.setCreatedAt(conversation.getCreatedAt());
        response.setUpdatedAt(conversation.getUpdatedAt());
        return response;
    }

    public Long getLastSenderId() {
        return lastSenderId;
    }

    public void setLastSenderId(Long lastSenderId) {
        this.lastSenderId = lastSenderId;
    }

    public Long getId() {
        return id;
    }

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

    public Long getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }

    public Long getStaffId() {
        return staffId;
    }

    public void setStaffId(Long staffId) {
        this.staffId = staffId;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getMode() {
        return mode;
    }

    public void setMode(String mode) {
        this.mode = mode;
    }

    public String getLastMessage() {
        return lastMessage;
    }

    public void setLastMessage(String lastMessage) {
        this.lastMessage = lastMessage;
    }

    public LocalDateTime getHumanRequestedAt() {
        return humanRequestedAt;
    }

    public void setHumanRequestedAt(LocalDateTime humanRequestedAt) {
        this.humanRequestedAt = humanRequestedAt;
    }

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