using StubCore.Entities;

namespace StubCore.Plugins.Helpers
{
    public class ODataResponse
    {
        public OperationResponse _opr;

        /// <summary>
        /// Operations report class. Moderated list of data operation
        /// </summary>
        /// <remarks>
        /// Last changed: 08.10.2015
        /// Author: Mikhael Aktsyzniy
        /// </remarks>
        public ODataResponse()
        {
            _opr = new OperationResponse();
            _opr.isError = true;
            _opr.isCompleted = false;
        }

        /// <summary>
        /// Reset class essense/data object
        /// </summary>
        /// <param name="_data">New data object</param>
        /// <remarks>
        /// Last changed: 08.10.2015
        /// Author: Mikhael Aktsyzniy
        /// </remarks>
        public void ResetEssense(OperationResponse _data)
        {
            _opr = _data;
        }

        /// <summary>
        /// Set message of operation
        /// </summary>
        /// <param name="_msg">Message string</param>
        /// <remarks>
        /// Last changed: 08.10.2015
        /// Author: Mikhael Aktsyzniy
        /// </remarks>
        public void SetMessage(string _msg)
        {
            _opr.message = _msg;
        }

        /// <summary>
        /// Set Error status. True/False
        /// </summary>
        /// <param name="_error">Error note</param>
        /// <remarks>
        /// Last changed: 08.10.2015
        /// Author: Mikhael Aktsyzniy
        /// </remarks>
        public void SetError(bool _error = false)
        {
            _opr.isError = _error;
        }

        /// <summary>
        /// Set Complete status. True/False
        /// </summary>
        /// <param name="_complete">Complete status</param>
        /// <remarks>
        /// Last changed: 08.10.2015
        /// Author: Mikhael Aktsyzniy
        /// </remarks>
        public void SetComplete(bool _complete = true)
        {
            _opr.isCompleted = _complete;
        }

    }
}
