package com.pablotj.ai.chat.domain.model;

/**
 * Enumeration representing the status of a conversation.
 */
public enum ConversationStatus {

    ACTIVE("active", "Conversation is active and accepting messages"),
    ARCHIVED("archived", "Conversation has been archived"),
    DELETED("deleted", "Conversation has been marked for deletion"),
    SUSPENDED("suspended", "Conversation has been temporarily suspended");

    private final String code;
    private final String description;

    ConversationStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public static ConversationStatus fromCode(String code) {
        for (ConversationStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown conversation status code: " + code);
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public boolean isActive() {
        return this == ACTIVE;
    }

    public boolean isArchived() {
        return this == ARCHIVED;
    }

    public boolean isDeleted() {
        return this == DELETED;
    }

    public boolean canReceiveMessages() {
        return this == ACTIVE;
    }
}
