﻿using System;
using System.Globalization;

namespace Lab5
{
    public class PhoneTarrif
	{
		private decimal outgoingCallPrice;
		private decimal incomingCallPrice;

		public PhoneTarrif()
		{
			this.outgoingCallPrice = this.incomingCallPrice = 0;
		}
		public PhoneTarrif(decimal? outPrice, decimal? inPrice)
		{
            this.outgoingCallPrice = outPrice ?? throw new ArgumentNullException("Outgoing price", "Outgoing price is null!");
			this.incomingCallPrice = inPrice ?? throw new ArgumentNullException("Incoming price", "Incoming price is null!");
		}

        public static bool IsNullOrEmpty(PhoneTarrif value)
        {
            if (value == null)
            {
                return true;
            }

            if (value.incomingCallPrice == 0 && value.outgoingCallPrice == 0)
            {
                return true;
            }

            return false;
        }
        public override string ToString()
        {
            return $"{((decimal) this.In).ToString("0.00", new CultureInfo("en-US"))}/{((decimal) this.Out).ToString("0.00", new CultureInfo("en-US"))} руб/мин";
        }

        public decimal? Out
		{
			get => this.outgoingCallPrice;
			set => this.outgoingCallPrice = value ?? throw new ArgumentNullException("Outgoing price", "Outgoing price is null!");
		}
		public decimal? In
		{
			get => this.incomingCallPrice;
			set => this.incomingCallPrice = value ?? throw new ArgumentNullException("Incoming price", "Incoming price is null!");
		}
	}
}
