class Nursing::LogDecorator < ApplicationDecorator
  delegate :name, to: :complaint, prefix: true, allow_nil: true
  delegate :full_name, to: :student, prefix: true

  def complaint_description
    return description unless complaint

    "#{complaint.name}: #{description}"
  end

  def student_name
    student.full_name(:reverse)
  end

  def author_name
    author&.full_name(:reverse)
  end

  def date
    entry_date.strftime('%b %d %Y')
  end

  def standardized_date
    return if entry_date.nil?

    l(entry_date.to_date)
  end

  def time
    entry_date&.strftime('%l:%M %P')
  end
end
