# == Schema Information
#
# Table name: sc_settings
#
#  id                      :integer          not null, primary key
#  index_number_of_views   :integer          default(0), not null
#  contact_number_of_views :integer          default(0), not null
#  shop_name               :string(255)
#  chk_quantity_global     :boolean          default(FALSE), not null
#  shop_active             :boolean          default(TRUE), not null
#  index_page_first_info   :text(4294967295)
#  index_page_second_info  :text(4294967295)
#  index_page_content      :text(4294967295)
#  shop_owners_emails      :text(65535)
#  recaptcha_chk           :boolean          default(FALSE), not null
#  updated_at              :datetime
#  updated_by              :integer
#

# main setting is stored in this model
class ScSetting < ApplicationRecord
  has_one :image, as: :imageable, dependent: :destroy

  YESNO_BOOL = {
    true => I18n.t('a_yes'),
    false => I18n.t('a_no')
  }.freeze

  YESNO = {
    true => 1,
    false => 0
  }.freeze

  YESNO_F = [
    { 'text' => I18n.t('a_no'), 'value' => 0 },
    { 'text' => I18n.t('a_yes'), 'value' => 1 }
  ].to_json

  def order_faqs
    OrderFaq.available.by_position_asc
  end
end
