using System.IO;
using BeWo.Data.Entities;

using BS.Shared.DataContracts;

namespace BeWo.Service.DCEntityMapper
{
    public class CustomerAPPCodeDC_CustomerAPPCode : AbstractIDCEntityMapper<CustomerAPPCode, CustomerAPPCodeDC>
    {
        public override CustomerAPPCodeDC MergeWithDC(CustomerAPPCode pEntity, CustomerAPPCodeDC pDataContract)
        {

            pDataContract.CustomerOid = pEntity.CustomerOid;
            pDataContract.CustomerCodeGenDate = pEntity.CustomerCodeGenDate;
            pDataContract.CustomerCode = pEntity.CustomerCode;
            pDataContract.IsChatAktive = pEntity.IsChatAktiv;
        
            return pDataContract;
        }

        public override CustomerAPPCode MergeWithEntity(CustomerAPPCodeDC pDataContract, CustomerAPPCode pEntity)
        {
            pEntity.CustomerOid = pDataContract.CustomerOid;
            pEntity.CustomerCodeGenDate = pDataContract.CustomerCodeGenDate;
            pEntity.CustomerCode = pDataContract.CustomerCode;
            pEntity.IsChatAktiv = pDataContract.IsChatAktive;
            
            return pEntity;
        }

        protected override bool AreDCAndEntityEqual(CustomerAPPCodeDC pDC, CustomerAPPCode pEntity)
        {

            if (pDC.CustomerAppCodeOid == null)
            {
                return false;
            }

            return pDC.CustomerAppCodeOid == pEntity.Oid;
        }
    }
}