using Foresight.Fleet.Services.Inspection.Package;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IronIntel.Contractor
{
    public class InspectionManager
    {
        public static byte[] GetInspectionPackage(string sessionid, string custid, string pkgid, out string name)
        {
            var client = FleetServiceClientHelper.CreateClient<InspectPackageProvider>();
            client.SessionID = sessionid;
            byte[] buffer = client._GetPackageContent(custid, pkgid);
            if (buffer != null)
            {
                var pkg = InspectPackage.FromBuffer(buffer);
                name = pkg.PackageName + ".ins";
                return buffer;
            }
            name = "";
            return null;
        }
    }
}
