﻿// MIT License. Copyright (c) 2016 Maxim Kuzmin. Contacts: https://github.com/maxim-kuzmin

// Author: Maxim Kuzmin

using Makc2016.Core.Execution.Operations.Async;
using Makc2016.Modules.AspNetIdentity.Models.Account.TwoFactor.CodeVerify;
using Microsoft.AspNet.Identity.Owin;
using System;
using System.Threading.Tasks;

namespace Makc2016.Modules.AspNetIdentity.Operations.Account
{
    public class ModuleAspNetIdentityOperationAccountTwoFactorCodeVerify : CoreExecutionOperationAsyncWithInputAndOutputData
        <
            ModuleAspNetIdentityModelAccountTwoFactorCodeVerifyInput,
            SignInStatus
        >
    {
        #region Constructors

        /// <summary>
        /// Конструктор.
        /// </summary>
        /// <param name="executableFunction">Выполняемая функция.</param>
        public ModuleAspNetIdentityOperationAccountTwoFactorCodeVerify(
            Func<ModuleAspNetIdentityModelAccountTwoFactorCodeVerifyInput, Task<SignInStatus>> executableFunction
            ) : base(
                executableFunction,
                null,
                TransformInputData,
                null,
                null
                )
        {
        }

        #endregion Constructors

        #region Internal methods

        internal static ModuleAspNetIdentityModelAccountTwoFactorCodeVerifyInput TransformInputData(ModuleAspNetIdentityModelAccountTwoFactorCodeVerifyInput inputData)
        {
            if (inputData == null)
            {
                inputData = new ModuleAspNetIdentityModelAccountTwoFactorCodeVerifyInput();
            }

            return inputData;
        }

        #endregion Internal methods
    }
}