from __future__ import unicode_literals

from ..base import Resource

from .agency import Agency


class Agent(Resource):
    _resource_name = 'agents'
    _is_listable = False

    _as_is_fields = [
        'id', 'href', 'role', 'first_name', 'last_name', 'email',
        'phone_numbers', 'username', 'active',
    ]
    _resource_fields = [('agency', Agency)]

from __future__ import unicode_literals

from ..base import BaseModel, Resource

from .agency import Agency


class AgentRole(BaseModel):
    _as_is_fields = ['id', 'name']


class AgentPhoneNumber(BaseModel):
    _as_is_fields = ['number', 'type']


class Agent(Resource):
    _resource_name = 'agents'
    _is_listable = False

    _as_is_fields = [
        'id',
        'href',
        'first_name',
        'last_name',
        'email',
        'username',
        'active',
    ]
    _model_fields = [
        ('role', AgentRole),
    ]
    _model_collection_fields = [
        ('phone_numbers', AgentPhoneNumber),
    ]
    _resource_fields = [('agency', Agency)]

Update Agent to use BaseModel classes to...
Update Agent to use BaseModel classes to...

represent Agent.role & Agent.phone_numbers fields

This will enable attribute access semantics for these fields

i.e.
> agent = client.agent.get(1234)
> agent.role['id']
> agent.phone_numbers[0]['number']

> agent.role.id
> agent.phone_numbers[0].number
