using System.IO;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Runtime.Serialization;
using System.Collections.Generic;

namespace ScanCodeServer
{
    [ServiceContract(Name = "Services")]
    internal interface IWeb
    {
        [OperationContract]
        [WebGet(UriTemplate = "StealAgv/takeOld?Place={place}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        Result TakeOldGet(string place);
        [OperationContract]
        [WebGet(UriTemplate = "alive", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string alive();
        [OperationContract]
        [WebInvoke(Method = "POST", UriTemplate = "Process?param={param}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string Process(Stream info,string param);
        [OperationContract]
        [WebInvoke(Method = "POST", UriTemplate = "ProcessBitmap?param={param}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string ProcessBitmap(Stream info, string param);
    }

    [DataContract]
    internal class Result
    {
        [DataMember]
        public int Code { get; set; }

        [DataMember]
        public string Msg { get; set; }
        
        [DataMember]
        public List<CodeInfo> CodeInfos { get; set; }


        public Result()
        {
            Code = 0;
            Msg = "OK";
            CodeInfos = new List<CodeInfo>();
        }
    }

}