﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.ServiceModel.Web;
using System.ServiceModel.Activation;
using LinkFuture.Library.WCF;

namespace LinkFuture.Demo
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IPSCService" in both code and config file together.
    [ServiceContract]
    public interface IXmlService
    {
        [OperationContract(Name = "XmlDoWork")]
        [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "DoWork/{ID}/{Filter}")]
        //[FormAuthorizeBehavior]
        [WCFDataCacheBehavior("Test")]
        ContentInfo DoWork(string id,string filter);
    }

    [ServiceContract]
    public interface IJsonService
    {
        [OperationContract(Name = "JsonDoWork")]
        [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "DoWork/{ID}/{Filter}")]
        [FormAuthorizeBehavior]
        ContentInfo DoWork(string id, string filter);
    }
    [ServiceContract]
    public interface IPSCService
    {
        [OperationContract(Name = "DoWork")]
        [FormAuthorizeBehavior(UnauthorizedAccessExceptionMessage = "not work")]
        ContentInfo DoWork(string id, string filter);

        [OperationContract]
        bool Login(string name, string password);

        [OperationContract]
        void Logout();

        [OperationContract]
        bool IsLogined();

        [OperationContract(Name = "DoHeadWork")]
        [AuthorizeHeaderBehavior(UnauthorizedAccessExceptionMessage = "no header", HeaderName = "Authorization",Role="admin")]
        ContentInfo DoHeadWork(string id, string filter);
    }
}
