using Hcs.Service.Async.Bills;
using System;

namespace Hcs.ClientNet.Api.Type
{
    // http://open-gkh.ru/Bills/PDServiceChargeType/MunicipalService/Consumption/Volume/determiningMethod.html
    public enum MunicipalServiceVolumeDeterminingMethod
    {
        Norm,
        MeteringDevice,
        Other
    }

    internal static class MunicipalServiceVolumeDeterminingMethodExtensions
    {
        internal static PDServiceChargeTypeMunicipalServiceVolumeDeterminingMethod ToServiceType(this MunicipalServiceVolumeDeterminingMethod type)
        {
            switch (type)
            {
                case MunicipalServiceVolumeDeterminingMethod.Norm:
                    return PDServiceChargeTypeMunicipalServiceVolumeDeterminingMethod.N;

                case MunicipalServiceVolumeDeterminingMethod.MeteringDevice:
                    return PDServiceChargeTypeMunicipalServiceVolumeDeterminingMethod.M;

                case MunicipalServiceVolumeDeterminingMethod.Other:
                    return PDServiceChargeTypeMunicipalServiceVolumeDeterminingMethod.O;
            }

            throw new NotImplementedException($"Cannot convert {type} to service type");
        }
    }
}
