class SectionArea
  include SimplyStored::Couch
  include ActiveModel::SerializerSupport
  property :title
  property :width, type: Float, default: 2
  property :height, type: Float, default: 2
  property :position_x, type: Float, default: 0
  property :position_y, type: Float, default: 0
  property :rounded, type: :boolean, default: false
  property :color
  belongs_to :section
  belongs_to :supplier

  view :by_supplier_id, key: :supplier_id
  view :by_section_id, key: :section_id

  def self.for_supplier(supplier)
    find_all_by_supplier_id(supplier.id)
  end
end
