using System;
using adMoto.Payments.Core;
using adMoto.Payments.Core.Data;
using System.Web.Mvc;
using Moq;

namespace adMoto.Payments.Test.Fakes
{
    public class TestDataHelper
    {
        public Invoice CreateInvoice(int id, string nip, string invoiceNumber, decimal brutto, byte systemKsiegowy)
        {
            var invoice = new Invoice();
            invoice.ID_faktury = id;
            invoice.nip = nip;
            invoice.Faktura_Numer = invoiceNumber;
            invoice.Brutto = brutto;
            invoice.SystemKsiegowyId = systemKsiegowy;

            return invoice;
        }
        public Invoice CreateForeignInvoice(int id, string nip, string invoiceNumber, decimal brutto, byte systemKsiegowy, decimal walutaBrutto, string currency)
        {
            var invoice = new Invoice();
            invoice.ID_faktury = id;
            invoice.nip = nip;
            invoice.Faktura_Numer = invoiceNumber;
            invoice.Brutto = brutto;
            invoice.waluta_brutto = walutaBrutto;
            invoice.waluta_miano = currency.ToUpper();
            invoice.SystemKsiegowyId = systemKsiegowy;
           
            return invoice;
        }
        public PlatnosciEcard CreateNewPayment(int orderNumber, bool status, DateTime data, int invoiceId)
        {
            var payment = new PlatnosciEcard();
            payment.ORDERNUMBER = orderNumber;
            payment.Status = status;
            payment.Status_data = data;
            payment.IDFaktury = invoiceId;

            return payment;
        }
        public PotwierdzeniaEcard CreateConfirm(string code, int ordernumber)
        {
            var potwierdzenie = new PotwierdzeniaEcard();
            potwierdzenie.CURRENTSTATE = code;
            potwierdzenie.ORDERNUMBER = ordernumber;

            return potwierdzenie;
        }
        
        public Payer CreatePayer(int id, string name, string surname)
        {
            var payer = new Payer {Id_faktury = id, FirstName = name, LastName = surname};

            return payer;
        }

        public ControllerContext CreateControllerContext(string userIdentity)
        {
            var mock = new Mock<ControllerContext>();
            mock.SetupGet(m => m.HttpContext.User.Identity.Name).Returns(userIdentity);
            mock.SetupGet(m => m.HttpContext.Request.IsAuthenticated).Returns(true);
           
            return mock.Object;
        }
    }
}