using EVCB_OCPP.Packet.Features.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EVCB_OCPP.Packet.Features
{
   
    public class CoreProfile : Profile
    {
        public CoreProfile()
        {
            Name = "Core";
            //加入支援的Features
            features.Add(new BootNotificationFeature());
            features.Add(new GetConfigurationFeature());
            features.Add(new HeartbeatFeature());
            features.Add(new StartTransactionFeature());
            features.Add(new ChangeConfigurationFeature());
            features.Add(new StatusNotificationFeature());
            features.Add(new StopTransactionFeature());
            features.Add(new MeterValuesFeature());
            features.Add(new RemoteStartTransactionFeature());
            features.Add(new RemoteStopTransactionFeature());
            features.Add(new ChangeAvailabilityFeature());
            features.Add(new AuthorizeFeature());
            features.Add(new ResetFeature());
            features.Add(new UnlockConnectorFeature());
            features.Add(new ClearCacheFeature());
            features.Add(new DataTransferFeature());

            actions.Add(Actions.BootNotification.ToString());
            actions.Add(Actions.GetConfiguration.ToString());
            actions.Add(Actions.Heartbeat.ToString());
            actions.Add(Actions.StartTransaction.ToString());
            actions.Add(Actions.ChangeConfiguration.ToString());
            actions.Add(Actions.StatusNotification.ToString());
            actions.Add(Actions.Authorize.ToString());
            actions.Add(Actions.StopTransaction.ToString());
            actions.Add(Actions.MeterValues.ToString());
            actions.Add(Actions.RemoteStartTransaction.ToString());
            actions.Add(Actions.RemoteStopTransaction.ToString());
            actions.Add(Actions.ChangeAvailability.ToString());
            actions.Add(Actions.ClearCache.ToString());
            actions.Add(Actions.DataTransfer.ToString());
            actions.Add(Actions.Reset.ToString());
            actions.Add(Actions.UnlockConnector.ToString());
          
        }

        public string GetActionFromConfirmation(Type seekType)
        {
            return features.Where(x => x.GetConfirmationType() == seekType).FirstOrDefault().GetAction();
        }

        public string GetActionFromRequest(Type seekType)
        {
            return GetFeaturebyType(seekType).GetAction();
        }
       



    }
}