using System.Text;

namespace Beam.Models {
    internal class StreamDocument(string filename, Stream content, Encoding? encoding = null) : Document(filename) {
        public Stream Content { get; set; } = content;
        public Encoding Encoding { get; set; } = encoding ?? Encoding.UTF8;

        byte[] Content_ { get; set; } = [];

        public override byte[] ToBytes() {
            return Content_;
        }

        public override string ToString() {
            return Encoding.GetString(Content_);
        }
    }
}
