using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using gehGassi.Klarna.Checkout;
using Newtonsoft.Json;
namespace gehGassi.Klarna.OrderManagement
{
public class OrderLine
{
///
/// Article number, SKU or similar.
///
/// Article number, SKU or similar.
[StringLength(255, MinimumLength = 0)]
[JsonProperty("reference")]
public string Reference { get; set; }
///
/// Order line type. Matches: physical|discount|shipping_fee|sales_tax|store_credit|gift_card|digital|surcharge|return_fee
///
/// Order line type. Matches: physical|discount|shipping_fee|sales_tax|store_credit|gift_card|digital|surcharge|return_fee
[RegularExpression("/physical|discount|shipping_fee|sales_tax|store_credit|gift_card|digital|surcharge|return_fee/")]
[JsonProperty("type")]
public string Type { get; set; }
///
/// Item quantity. Non-negative.
///
/// Item quantity. Non-negative.
[Required]
[JsonProperty("quantity")]
public long? Quantity { get; set; }
///
/// Unit used to describe the quantity. Maximum 10 characters.
///
/// Unit used to describe the quantity. Maximum 10 characters.
[StringLength(10, MinimumLength = 0)]
[JsonProperty("quantity_unit")]
public string QuantityUnit { get; set; }
///
/// Descriptive item name. Maximum 255 characters.
///
/// Descriptive item name. Maximum 255 characters.
[Required]
[StringLength(255, MinimumLength = 0)]
[JsonProperty("name")]
public string Name { get; set; }
///
/// Total amount including tax and discounts (`quantity * unit_price - total_discount_amount`).
///
/// Total amount including tax and discounts (`quantity * unit_price - total_discount_amount`).
[Required]
[JsonProperty("total_amount")]
public long? TotalAmount { get; set; }
///
/// Unit price including tax without applying discounts in minor units.
///
/// Unit price including tax without applying discounts in minor units.
[Required]
[JsonProperty("unit_price")]
public long? UnitPrice { get; set; }
///
/// The discount amount in minor units. Includes tax. Example: 1200 = $12. Max value: 100000000
///
/// The discount amount in minor units. Includes tax. Example: 1200 = $12. Max value: 100000000
[Range(0, 100000000)]
[JsonProperty("total_discount_amount")]
public long? TotalDiscountAmount { get; set; }
///
/// The tax rate in percent with two implicit decimals. Non-negative. Example: 2500 = 25%.
///
/// The tax rate in percent with two implicit decimals. Non-negative. Example: 2500 = 25%.
[JsonProperty("tax_rate")]
public int? TaxRate { get; set; }
///
/// The total tax amount in minor units. Negative if the order line type is discount. Example: 500 = $5.
///
/// The total tax amount in minor units. Negative if the order line type is discount. Example: 500 = $5.
[JsonProperty("total_tax_amount")]
public long? TotalTaxAmount { get; set; }
///
/// Data about the order line. Set at creation or update and returned when fetching the order through the API. Maximum 1024 characters.
///
/// Data about the order line. Set at creation or update and returned when fetching the order through the API. Maximum 1024 characters.
[StringLength(1024, MinimumLength = 0)]
[JsonProperty("merchant_data")]
public string MerchantData { get; set; }
///
/// URL to the product that can be used in communications between Klarna and the customer. Maximum 1024 characters.
///
/// URL to the product that can be used in communications between Klarna and the customer. Maximum 1024 characters.
[StringLength(1024, MinimumLength = 0)]
[JsonProperty("product_url")]
public string ProductUrl { get; set; }
///
/// URL to an image that can be embedded in communications between Klarna and the customer. Maximum 1024 characters.
///
/// URL to an image that can be embedded in communications between Klarna and the customer. Maximum 1024 characters.
[StringLength(1024, MinimumLength = 0)]
[JsonProperty("image_url")]
public string ImageUrl { get; set; }
///
/// Identifiers to better describe the product for improved risk assessment, support, presentation to consumers and promotional functionality.
///
/// Identifiers to better describe the product for improved risk assessment, support, presentation to consumers and promotional functionality.
[JsonProperty("product_identifiers")]
public ProductIdentifiers ProductIdentifiers { get; set; }
}
}