using System;
using Com.Bocom.OpenApi.Response;
using Com.Bocom.OpenApi.Security.KeyGen;
using Com.Bocom.OpenApi.Utils;

namespace Com.Bocom.OpenApi
{
    namespace Request
    {
        public class FileUploadRequestV1 : BocomUploadEncryptRequest<FileUploadResponseV1>
        {
            /// <summary>
            /// 获取响应类
            /// </summary>
            /// <returns>返回IntegralExchangeCheckResponseV1类对应的响应类类型</returns>
            public override Type GetResponseClass()
            {
                return typeof(FileUploadResponseV1);
            }

            /// <summary>
            /// 是否支持加密（目前sdk只支持对字段进行AES加解密）
            /// </summary>
            /// <returns>一般返回false</returns>
            public override bool IsNeedEncrypt()
            {
                return true;
            }

            /// <summary>
            /// http发起请求方式（支持GET、POST两种方式）
            /// </summary>
            /// <returns>一般返回POST</returns>
            public override string GetMethod()
            {
                return "POST";
            }

            private FileItem fileItem;

            public void setFileItem(FileItem f)
            {
                fileItem = f;
            }


            public override string GetEncryptType()
            {
                return BocomConstants.ENCRYPT_TYPE_RSA_AND_AES;
            }

            public override string GetEncryptPolicy()
            {
                return BocomConstants.ENCRYPT_POLICY_TYPE_FILE;
            }

            private string encryptKey = AESKeyGen.GenAES256Key();

            public override string GetEncryptKey()
            {
                return encryptKey;
            }

            public override FileItem GetFileItem()
            {
                return fileItem;
            }

            /// <summary>
            /// 获取业务类类型
            /// </summary>
            /// <returns>返回request类内部定义的BizContent类的类型</returns>
            public override Type GetBizContentClass()
            {
                return null;
            }

            /*   [DataMember]
              private FileItem fileItem;           
              public FileItem FileItem
                             {
                      get { return fileItem; }
                    //  set { protocol_no = value; }
                  }*/
        }
    }
}