using System.ComponentModel.DataAnnotations;

namespace ApiTerceiroSimulador.Models.OpenDelivery
{
    public class PaymentMethod
    {
        /// <summary>
        /// Price value. 4 decimals places are accepted
        /// </summary>
        public required decimal Value { get; set; } // 0,

        /// <summary>
        /// The 3-letter ISO 4217 currency code.
        /// </summary>
        [Required, RegularExpression("^[A-Z]{3}$")]
        public required string Currency { get; set; }

        public required string Type { get; set; } = PaymentTypes.Prepaid; // "PREPAID",
        
        public required string Method { get; set; } // = PaymentMethds.Credit; // "CREDIT",

        /// <summary>
        /// Indicates the brand of the card selected in the method field.
        /// This field must only be filled in if method is CREDIT, DEBIT, CREDIT_DEBIT, MEAL_VOUCHER or FOOD_VOUCHER.
        /// If OTHER is chosen, it is recommended that you describe the brand name in the methodInfo field.
        /// </summary>
        public string? Brand { get; set; } // = PaymentBrands.Visa; // "VISA",

        /// <summary>
        /// Additional information regarding the payment method.
        /// It can be used to indicate some useful information of the chosen payment method, such as the name of the wallet, or an authorization number.
        /// This field can be used for any method entered, but it is highly recommended to fill it in when the chosen method is OTHER.
        /// </summary>
        public string? MethodInfo { get; set; }

        /// <summary>
        /// Authorization details and intermediary identification for credit card and/or subsidy transactions
        /// </summary>
        public PaymentTransaction? Transaction { get; set; }

        /// <summary>
        /// Indicates the total that will be paid in cash by the customer and that should be considered for the calculation of the change
        ///     (ex.customer will pay a $43 order with a $50 bill.Then 50.00 must be entered.).
        /// Only mandatory when method is CASH.
        /// </summary>
        public decimal? ChangeFor { get; set; } = 0;
    }
}
