using System;
using System.Collections.Generic;
using System.IO.Abstractions;
using Quadarax.Foundation.Core.IO.MimeTypes;

namespace BO.ProcessServer.Business
{
    public class DocumentContent
    {
        public long DocumentId { get; set; }
        public IList<FileContent> Files { get; }

        public DocumentContent(long documentId, IFileSystem fileSystem, IEnumerable<string> fileNames)
        {
            if (fileSystem==null) throw new ArgumentNullException(nameof(fileSystem));
            if (fileNames == null) throw new ArgumentNullException(nameof(fileNames));

            foreach (var fileName in fileNames)
                Files.Add(new FileContent() {FileName = fileName, MimeType = MimeTypeUtil.GetMimeType(fileSystem.Path.GetExtension(fileName))});

            DocumentId = documentId;
        }
    }

    public class FileContent
    {
        public string FileName { get; set; }
        public string MimeType { get; set; }
    }
}
