 
     if @length is 1
       @trigger('limit:one', @)
-  
+
   reset: (models, options) ->
     options or (options = {})
 


    if @length is 1
      @trigger('limit:one', @)
      
class Typus.Serialize.Collections.List extends Backbone.Collection

  model: Typus.Serialize.Models.Item

  initialize: (models, options) ->
    { @name, @keys, @locales } = options
    @min = options.limit.min or 0
    @max = options.limit.max or Infinity

  translatable: ->
    @locales.length > 0

  add: (models, options) ->
    if @length < @max
      super(models, options)

    if @length >= @max
      @trigger('limit:max', @)

  remove: (models, options) ->
    if @length > @min
      super(models, options)
