<commit_before>﻿using System;
using System.Xml.Linq;
using Intacct.Infrastructure;

namespace Intacct.Entities
{
	public class IntacctLineItem : IntacctObject
	{
	    public IntacctLineItem(XElement data)
	    {
	        this.SetPropertyValue(x => AccountNumber, data);
	        this.SetPropertyValue(x => AccountLabel, data, true);
	        this.SetPropertyValue(x => Amount, data);
	        this.SetPropertyValue(x => Memo, data);
	        this.SetPropertyValue(x => LocationId, data);
	        this.SetPropertyValue(x => DepartmentId, data);
	    }

        [IntacctName("glaccountno")]
		public string AccountNumber { get; private set; }
        [IntacctName("accountlabel")]
		public string AccountLabel { get; private set; }
        
		public decimal Amount { get; set; }

		public string Memo { get; set; }
        public string LocationId { get; set; }
        public string DepartmentId { get; set; }

		public static IntacctLineItem CreateWithAccountNumber(string accountNumber, decimal amount)
		{
			return new IntacctLineItem(amount) { AccountNumber = accountNumber };
		}

		public static IntacctLineItem CreateWithAccountLabel(string accountLabel, decimal amount)
		{
			return new IntacctLineItem(amount) { AccountLabel = accountLabel };
		}

        
		private IntacctLineItem(decimal amount)
		{
			Amount = amount;
		}

		internal override XObject[] ToXmlElements()
		{
			return new XObject[]
				       {
					       GetAccountXmlElement(),
					       new XElement("amount", Amount),
						   new XElement("memo", Memo ?? ""), 
                           new XElement("locationid", LocationId),
                           new XElement("departmentid", DepartmentId)
				       };
		}

		private XElement GetAccountXmlElement()
		{
			if (!string.IsNullOrWhiteSpace(AccountNumber)) return new XElement("glaccountno", AccountNumber);
			if (!string.IsNullOrWhiteSpace(AccountLabel)) return new XElement("accountlabel", AccountLabel);

			throw new Exception("Unable to generate line item XML because neither account number or label are set.");
		}
	}
}<commit_msg>use ints for ids for simpler integration w/domain<commit_after>﻿using System;
using System.Xml.Linq;
using Intacct.Infrastructure;

namespace Intacct.Entities
{
	public class IntacctLineItem : IntacctObject
	{
	    public IntacctLineItem(XElement data)
	    {
	        this.SetPropertyValue(x => AccountNumber, data);
	        this.SetPropertyValue(x => AccountLabel, data, true);
	        this.SetPropertyValue(x => Amount, data);
	        this.SetPropertyValue(x => Memo, data);
	        this.SetPropertyValue(x => LocationId, data);
	        this.SetPropertyValue(x => DepartmentId, data);
	    }

        [IntacctName("glaccountno")]
		public int AccountNumber { get; private set; }
        [IntacctName("accountlabel")]
		public string AccountLabel { get; private set; }
        
		public decimal Amount { get; set; }

		public string Memo { get; set; }
        public int LocationId { get; set; }
        public int DepartmentId { get; set; }

		public static IntacctLineItem CreateWithAccountNumber(int accountNumber, decimal amount)
		{
			return new IntacctLineItem(amount) { AccountNumber = accountNumber };
		}

		public static IntacctLineItem CreateWithAccountLabel(string accountLabel, decimal amount)
		{
			return new IntacctLineItem(amount) { AccountLabel = accountLabel };
		}

        
		private IntacctLineItem(decimal amount)
		{
			Amount = amount;
		}

		internal override XObject[] ToXmlElements()
		{
			return new XObject[]
				       {
					       GetAccountXmlElement(),
					       new XElement("amount", Amount),
						   new XElement("memo", Memo ?? ""), 
                           new XElement("locationid", LocationId),
                           new XElement("departmentid", DepartmentId)
				       };
		}

		private XElement GetAccountXmlElement()
		{
			if (!string.IsNullOrWhiteSpace(AccountNumber.ToString())) return new XElement("glaccountno", AccountNumber);
			if (!string.IsNullOrWhiteSpace(AccountLabel)) return new XElement("accountlabel", AccountLabel);

			throw new Exception("Unable to generate line item XML because neither account number or label are set.");
		}
	}
}
{'fraction_non_alphanumeric': 0.09711973339681028, 'fraction_numerical': 0.0, 'mean_word_length': 3.111545988258317, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1850270', 'n_tokens_mistral': 1299, 'n_tokens_neox': 1153, 'n_words': 303}