package edu.upvehu.gbg.xml.jaxb;

import javax.xml.bind.annotation.*;

@XmlAccessorType(XmlAccessType.FIELD)
public class Mensaje {

    @XmlAttribute(name = "id")
    private String id;

    @XmlAttribute(name = "remitente")
    private String remitente;

    @XmlAttribute(name = "fecha")
    private String fecha;

    @XmlAttribute(name = "hora")
    private String hora;

    // CORRECCIÓN: Se añade required=true para forzar la salida del elemento <texto>, 
    // incluso si su contenido es leído como una cadena vacía por el parser.
    @XmlElement(name = "texto", namespace = "http://www.example.com/chat", required = true)
    private String texto;

    // El elemento complejo Adjunto
    @XmlElement(name = "adjunto", namespace = "http://www.example.com/chat", required = true)
    private Adjunto adjunto;

    // Getters y Setters
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getRemitente() {
        return remitente;
    }

    public void setRemitente(String remitente) {
        this.remitente = remitente;
    }

    public String getFecha() {
        return fecha;
    }

    public void setFecha(String fecha) {
        this.fecha = fecha;
    }

    public String getHora() {
        return hora;
    }

    public void setHora(String hora) {
        this.hora = hora;
    }

    public String getTexto() {
        return texto;
    }

    public void setTexto(String texto) {
        this.texto = texto;
    }

    public Adjunto getAdjunto() {
        return adjunto;
    }

    public void setAdjunto(Adjunto adjunto) {
        this.adjunto = adjunto;
    }
}