class InstitutionService < ActiveRecord::Base

  # Accessors
  attr_accessible :description, :institution_id, :name, :attachments_attributes,
    :general_requirements, :response_times, :active, :observations, :institution_service_category_id,
    :institution_service_attachments_attributes, :schedule

  # Associations
  belongs_to :institution
  belongs_to :institution_service_category

  has_many :institution_service_steps, order: :priority
  accepts_nested_attributes_for :institution_service_steps, reject_if: :all_blank, allow_destroy: true

  has_many :institution_service_attachments, as: :attachable
  accepts_nested_attributes_for :institution_service_attachments, allow_destroy: true

  # Validations
  validates :institution_id, :institution_service_category_id, :name, :description, presence: true
end
