﻿using System;
using CalculatorsLibrary.Enumeration;

namespace CalculatorsLibrary.Formulas.Milling
{
    public class MillingShoulder : MillingFaceStraightInserts, IMillingShoulder
    {
		/// <summary>
		/// Calculates the average chipthickness based on the <paramref name="entryAngle"/>, <paramref name="radialDepthOfCut"/>, <paramref name="feedPerTooth"/> and <paramref name="diameterCutting"/> [Coromant Technical Guide, p. I6].
		/// This formula is based on the input of <paramref name="feedPerTooth"/>
		/// </summary>
		public double AverageChipThicknessOptionFeedPerTooth(double entryAngle, double radialDepthOfCut, double feedPerTooth, double diameterCutting)
        {
            return base.AverageChipThicknessOptionFeedPerTooth(MillingStrategy.SideMilling, entryAngle, radialDepthOfCut, feedPerTooth, diameterCutting);
        }

		/// <summary>
		/// Calculates the feed per tooth based on the <paramref name="entryAngle"/>, <paramref name="radialDepthOfCut"/>, <paramref name="averageChipThickness"/> and <paramref name="diameterCutting"/> [Coromant Technical Guide, p. I6].
		/// This formula is based on the input of <paramref name="averageChipThickness"/>
		/// </summary>
		public double FeedPerToothAverageChipThickness(double entryAngle, double radialDepthOfCut, double averageChipThickness, double diameterCutting)
        {
            return base.FeedPerToothAverageChipThickness(MillingStrategy.SideMilling, entryAngle, radialDepthOfCut, averageChipThickness, diameterCutting);
        }

		/// <summary>
		/// Calculates the feed per tooth based on the <paramref name="entryAngle"/>, <paramref name="radialCuttingDepth"/>, <paramref name="maximumChipThickness"/> and <paramref name="diameterCutting"/> [Coromant Technical Guide, p. I6].
		/// This formula is based on the input of <paramref name="maximumChipThickness"/>
		/// </summary>
		public double FeedPerToothMaximumChipThickness(double entryAngle, double radialCuttingDepth, double maximumChipThickness, double diameterCutting)
        {
            return (maximumChipThickness * diameterCutting) / (2 * Sinus(entryAngle) * Math.Sqrt(diameterCutting * radialCuttingDepth - Math.Pow(radialCuttingDepth, 2)));
        }

		/// <summary>
		/// Calculates the maximum chipthickness based on the <paramref name="entryAngle"/>, <paramref name="radialCuttingDepth"/>, <paramref name="feedPerTooth"/> and <paramref name="diameterCutting"/> [Coromant Technical Guide, p. I6].
		/// This formula is based on the input of <paramref name="feedPerTooth"/>
		/// </summary>
		public double MaximumChipThicknessFeedPerTooth(double entryAngle, double radialCuttingDepth, double feedPerTooth, double diameterCutting)
        {
            return (feedPerTooth * 2 * Sinus(entryAngle) * Math.Sqrt(diameterCutting * radialCuttingDepth - Math.Pow(radialCuttingDepth, 2))) / (diameterCutting);
        }
    }
}
