class Statement < InvoicingRecord
  belongs_to :right_owner, optional: true
  has_many :statement_lines, dependent: :delete_all

  delegate :full_name, to: :right_owner

  def status_text
    @status_text ||= I18n.t("statement_statuses.#{status}", default: nil)
  end

  def total_ht
    @total_ht ||= total - vat_amount
  end

  def sub_total
    @sub_total ||= total_rights - total_fees
  end

  def done?
    status == 'done'
  end
end
