attr = DS.attr
App.Supplier = DS.Model.extend
  name: attr 'string'
  user_message: attr 'string'
  email: attr 'string'
  time_zone: attr 'string'
  address: attr 'string'
  house_number: attr 'number'
  house_number_addition: attr 'string'
  postal_code: attr 'string'
  city: attr 'string'
  open: attr 'boolean'
  country: attr 'string'
  facebook_promotion_url: attr 'string'
  iens_profile: attr 'string'
  lat: attr 'number'
  lng: attr 'number'
  week_starts_on_monday: attr 'boolean'
  orders_in_process_count: attr('number')
  orders_placed_count: attr('number')

  product_categories: DS.hasMany 'product_category', async: false
  employee_shifts: DS.hasMany('employee-shift')

  close: ->
    $.post Routes.mark_as_closed_suppliers_supplier_path(@id), =>
      @set 'open', false
  open_the_place: ->
    $.post Routes.mark_as_open_suppliers_supplier_path(@id), =>
      @set 'open', true

