<commit_before>﻿using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
#if PORTABLE
using System.Threading.Tasks;
#endif

namespace Avalara.AvaTax.RestClient
{
    /// <summary>
    /// TransactionBuilder helps you construct a new transaction using a fluent interface
    /// </summary>
    public class TransactionBuilder
    {
        private CreateTransactionModel _model;
        private int _line_number;
        private AvaTaxClient _client;

        #region Constructor
        /// <summary>
        /// TransactionBuilder helps you construct a new transaction using a fluent interface
        /// </summary>
        /// <param name="client">The AvaTaxClient object to use to create this transaction</param>
        /// <param name="companyCode">The code of the company for this transaction</param>
        /// <param name="type">The type of transaction to create</param>
        /// <param name="customerCode">The customer code for this transaction</param>
        public TransactionBuilder(AvaTaxClient client, string companyCode, DocumentType type, string customerCode)
        {
            _model = new CreateTransactionModel
            {
                companyCode = companyCode,
                customerCode = customerCode,
                date = DateTime.UtcNow,
                type = type,
                lines = new List<LineItemModel>()
            };
            _line_number = 1;
            _client = client;
        }
        #endregion

        #region Builder Pattern
        /// <summary>
        /// Set the commit flag of the transaction.
        /// </summary>
        /// <returns>The TransactionBuilder object</returns>
        public TransactionBuilder WithCommit()
        {
            _model.commit = true;
            return this;
        }

        /// <summary>
        /// Enable diagnostic information
        /// </summary>
        /// <returns>The TransactionBuilder object</returns>
        public TransactionBuilder WithDiagnostics()
        {
            _model.debugLevel = TaxDebugLevel.Diagnostic;
            return this;
        }

        /// <summary>
        /// Specify a specific usage type for the entire transaction
        /// </summary>
        /// <param name="usageType"></param>
        /// <returns></returns>
        public TransactionBuilder WithUsageType(string usageType)
        {
            _model.customerUsageType = usageType;
            return this;
        }

        /// <summary>
        /// Specify a specific entity use code for the entire transaction
        /// </summary>
        /// <param name="useCode"></param>
        /// <returns></returns>
        public TransactionBuilder WithEntityUseCode(string useCode)
        {<commit_msg>add entityUseCode method to transaction builder<commit_after>﻿using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
#if PORTABLE
using System.Threading.Tasks;
#endif

namespace Avalara.AvaTax.RestClient
{
    /// <summary>
    /// TransactionBuilder helps you construct a new transaction using a fluent interface
    /// </summary>
    public class TransactionBuilder
    {
        private CreateTransactionModel _model;
        private int _line_number;
        private AvaTaxClient _client;

        #region Constructor
        /// <summary>
        /// TransactionBuilder helps you construct a new transaction using a fluent interface
        /// </summary>
        /// <param name="client">The AvaTaxClient object to use to create this transaction</param>
        /// <param name="companyCode">The code of the company for this transaction</param>
        /// <param name="type">The type of transaction to create</param>
        /// <param name="customerCode">The customer code for this transaction</param>
        public TransactionBuilder(AvaTaxClient client, string companyCode, DocumentType type, string customerCode)
        {
            _model = new CreateTransactionModel
            {
                companyCode = companyCode,
                customerCode = customerCode,
                date = DateTime.UtcNow,
                type = type,
                lines = new List<LineItemModel>()
            };
            _line_number = 1;
            _client = client;
        }
        #endregion

        #region Builder Pattern
        /// <summary>
        /// Set the commit flag of the transaction.
        /// </summary>
        /// <returns>The TransactionBuilder object</returns>
        public TransactionBuilder WithCommit()
        {
            _model.commit = true;
            return this;
        }

        /// <summary>
        /// Enable diagnostic information
        /// </summary>
        /// <returns>The TransactionBuilder object</returns>
        public TransactionBuilder WithDiagnostics()
        {
            _model.debugLevel = TaxDebugLevel.Diagnostic;
            return this;
        }

        /// <summary>
        /// Specify a specific usage type for the entire  transaction
        /// </summary>
        /// <param name="usageType"></param>
        /// <returns></returns>
        public TransactionBuilder WithUsageType(string usageType)
        {
            _model.customerUsageType = usageType;
            return this;
        }

        /// <summary>
        /// Specify a specific entity use code for the entire transaction
        /// </summary>
        /// <param name="useCode"></param>
        /// <returns></returns>
        public TransactionBuilder WithEntityUseCode(string useCode)
        {
{'fraction_non_alphanumeric': 0.09601155026168562, 'fraction_numerical': 0.00036094567767550983, 'mean_word_length': 1.8909754825247782, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 69, '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': '1277133', 'n_tokens_mistral': 1287, 'n_tokens_neox': 1272, 'n_words': 389}