from __future__ import unicode_literals

from gapipy.resources.base import Resource
from gapipy.resources.booking_company import BookingCompany


class AgencyChain(Resource):
    _resource_name = 'agency_chains'

    _as_is_fields = [
        'id',
        'href',
        'name',
        'agencies',
        'agent_notifications',
        'communication_preferences',
        'flags',
        'payment_options',
        'passenger_notifications',
    ]

    _date_time_fields_local = [
        'date_created',
        'date_last_modified',
    ]

    _resource_fields = [
        ('booking_company', BookingCompany),
    ]

from __future__ import unicode_literals

from gapipy.resources.base import Resource
from gapipy.resources.booking_company import BookingCompany


class AgencyChain(Resource):
    _resource_name = 'agency_chains'
    _is_parent_resource = True

    _as_is_fields = [
        'id',
        'href',
        'name',
        'agent_notifications',
        'communication_preferences',
        'flags',
        'payment_options',
        'passenger_notifications',
    ]

    _date_time_fields_local = [
        'date_created',
        'date_last_modified',
    ]

    _resource_fields = [
        ('booking_company', BookingCompany),
    ]

    _resource_collection_fields = [('agencies', 'Agency')]

Make `AgencyChain.agencies` a "resource collection" field
Make `AgencyChain.agencies` a "resource collection" field

We can now get a `Query` when accessing the `agencies` attribute on an
`AgencyChain` instead of a dict with an URI to the agencies list.

  from __future__ import unicode_literals
  
  from gapipy.resources.base import Resource
  from gapipy.resources.booking_company import BookingCompany
  
  
  class AgencyChain(Resource):
      _resource_name = 'agency_chains'
+     _is_parent_resource = True
  
      _as_is_fields = [
          'id',
          'href',
          'name',
-         'agencies',
          'agent_notifications',
          'communication_preferences',
          'flags',
          'payment_options',
          'passenger_notifications',
      ]
  
      _date_time_fields_local = [
          'date_created',
          'date_last_modified',
      ]
  
      _resource_fields = [
          ('booking_company', BookingCompany),
      ]
  
+     _resource_collection_fields = [('agencies', 'Agency')]
+ 
Make `AgencyChain.agencies` a "resource collection" field
## Code Before:
from __future__ import unicode_literals

from gapipy.resources.base import Resource
from gapipy.resources.booking_company import BookingCompany


class AgencyChain(Resource):
    _resource_name = 'agency_chains'

    _as_is_fields = [
        'id',
        'href',
        'name',
        'agencies',
        'agent_notifications',
        'communication_preferences',
        'flags',
        'payment_options',
        'passenger_notifications',
    ]

    _date_time_fields_local = [
        'date_created',
        'date_last_modified',
    ]

    _resource_fields = [
        ('booking_company', BookingCompany),
    ]

## Instruction:
Make `AgencyChain.agencies` a "resource collection" field
## Code After:
from __future__ import unicode_literals

from gapipy.resources.base import Resource
from gapipy.resources.booking_company import BookingCompany


class AgencyChain(Resource):
    _resource_name = 'agency_chains'
    _is_parent_resource = True

    _as_is_fields = [
        'id',
        'href',
        'name',
        'agent_notifications',
        'communication_preferences',
        'flags',
        'payment_options',
        'passenger_notifications',
    ]

    _date_time_fields_local = [
        'date_created',
        'date_last_modified',
    ]

    _resource_fields = [
        ('booking_company', BookingCompany),
    ]

    _resource_collection_fields = [('agencies', 'Agency')]
