/* Copyright (C) Itseez3D, Inc. - All Rights Reserved
* You may not use this file except in compliance with an authorized license
* Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential
* UNLESS REQUIRED BY APPLICABLE LAW OR AGREED BY ITSEEZ3D, INC. IN WRITING, SOFTWARE DISTRIBUTED UNDER THE LICENSE IS DISTRIBUTED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED
* See the License for the specific language governing permissions and limitations under the License.
* Written by Itseez3D, Inc. <support@avatarsdk.com>, October 2026
*/

namespace AvatarSDKMove
{
	public static class GenerationPricing
	{
		public static int GetBasePrice(int duration)
		{
			return duration * AvatarSDKMoveSettings.CoinsPerAnimationSecond;
		}

		public static bool IsPurchaseRequired(UserInfoData userInfo)
		{
			return !userInfo.have_asdk_subscription;
		}

		public static int GetPrice(UserInfoData userInfo, int duration)
		{
			if (!IsPurchaseRequired(userInfo) || userInfo.free_move_animations > 0)
				return 0;
			return GetBasePrice(duration);
		}

		public static bool CanAfford(UserInfoData userInfo, int duration)
		{
			return GetPrice(userInfo, duration) <= userInfo.balance;
		}

		public static int GetDisplayPrice(UserInfoData userInfo, int duration)
		{
			return userInfo == null ? GetBasePrice(duration) : GetPrice(userInfo, duration);
		}

		public static string FormatPrice(UserInfoData userInfo, int duration)
		{
			int price = GetDisplayPrice(userInfo, duration);
			return price == 0 ? "Free" : string.Format("{0} coins", price);
		}
	}
}
