<commit_before>module AccountingLinesMixin

  attr_accessor :accounting_lines, :initial_lines

  def default_accounting_lines(opts={})
    # This just makes it so we don't have to be so repetitive. It can certainly be
    # overridden in a subclass if you don't want to chuck things in via opts.
    {
        accounting_lines: {
            source: collection('AccountingLineObject'),
            target: collection('AccountingLineObject')
        },
        initial_lines:    []
    }.merge(opts)
  end

  def post_create
    super
    @initial_lines.each{ |il| add_line((il[:type].nil? ? :source : il[:type]), il) }
  end

  def add_line(type, al)
    @accounting_lines[type].add(al.merge({type: type}))
  end

  def add_target_line(al)
    add_line(:target, al)
  end

  def add_source_line(al)
    add_line(:source, al)
  end

end

module BudgetAdjustmentLinesMixin
  include AccountingLinesMixin
  extend AccountingLinesMixin

  def default_lines(opts={})
    {
        accounting_lines: {
            source: collection('BudgetAdjustmentLineObject'),
            target: collection('BudgetAdjustmentLineObject')
        },
        initial_lines:    []
    }.merge(opts)
  end

end

module VoucherLinesMixin
  include AccountingLinesMixin
  extend AccountingLinesMixin

  def default_lines(opts={})
    {
        accounting_lines: {
            source: collection('VoucherLineObject'),
            target: collection('VoucherLineObject')
        },<commit_msg>[KFSQA-649] JV is pretty much done.<commit_after>module AccountingLinesMixin

  attr_accessor :accounting_lines, :initial_lines

  def default_accounting_lines(opts={})
    # This just makes it so we don't have to be so repetitive. It can certainly be
    # overridden in a subclass if you don't want to chuck things in via opts.
    {
        accounting_lines: {
            source: collection('AccountingLineObject'),
            target: collection('AccountingLineObject')
        },
        initial_lines:    []
    }.merge(opts)
  end

  def post_create
    super
    @initial_lines.each{ |il| add_line((il[:type].nil? ? :source : il[:type]), il) }
  end

  def add_line(type, al)
    @accounting_lines[type].add(al.merge({type: type}))
  end

  def add_target_line(al)
    add_line(:target, al)
  end

  def add_source_line(al)
    add_line(:source, al)
  end

end

module BudgetAdjustmentLinesMixin
  include AccountingLinesMixin
  extend AccountingLinesMixin

  def default_accounting_lines(opts={})
    {
        accounting_lines: {
            source: collection('BudgetAdjustmentLineObject'),
            target: collection('BudgetAdjustmentLineObject')
        },
        initial_lines:    []
    }.merge(opts)
  end

end

module VoucherLinesMixin
  include AccountingLinesMixin
  extend AccountingLinesMixin

  def default_accounting_lines(opts={})
    {
        accounting_lines: {
            source: collection('VoucherLineObject'),
            target: collection('VoucherLineObject')
        },
{'fraction_non_alphanumeric': 0.09408602150537634, 'fraction_numerical': 0.0010080645161290322, 'mean_word_length': 3.055858310626703, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '930690', 'n_tokens_mistral': 926, 'n_tokens_neox': 891, 'n_words': 209}