from django.conf.urls.defaults import url, include, patterns
from corehq.apps.appstore.dispatcher import AppstoreDispatcher

store_urls = patterns('corehq.apps.appstore.views',
    url(r'^$', 'appstore_default', name="appstore_interfaces_default"),
    AppstoreDispatcher.url_pattern(),
)

urlpatterns = patterns('corehq.apps.appstore.views',
    url(r'^$', 'appstore', name='appstore'),
    url(r'^api/', 'appstore_api', name='appstore_api'),
    url(r'^store/', include(store_urls)),

    url(r'^(?P<domain>[\w\.-]+)/info/$', 'project_info', name='project_info'),

    url(r'^deployments/$', 'deployments', name='deployments'),
    url(r'^deployments/api/$', 'deployments_api', name='deployments_api'),
    url(r'^deployments/(?P<domain>[\w\.-]+)/info/$', 'deployment_info', name='deployment_info'),

    url(r'^(?P<domain>[\w\.-]+)/approve/$', 'approve_app', name='approve_appstore_app'),
    url(r'^(?P<domain>[\w\.-]+)/copy/$', 'copy_snapshot', name='domain_copy_snapshot'),
    url(r'^(?P<domain>[\w\.-]+)/importapp/$', 'import_app', name='import_app_from_snapshot'),
    url(r'^(?P<domain>[\w\.-]+)/image/$', 'project_image', name='appstore_project_image'),
    url(r'^(?P<domain>[\w\.-]+)/multimedia/$', 'media_files', name='media_files'),
)


[(5, 'django.conf.urls.defaults.url', 'url', (['"""^$"""', '"""appstore_default"""'], {'name': '"""appstore_interfaces_default"""'}), False, 'from django.conf.urls.defaults import url, include, patterns\n'), (6, 'corehq.apps.appstore.dispatcher.AppstoreDispatcher.url_pattern', 'AppstoreDispatcher.url_pattern', ([], {}), False, 'from corehq.apps.appstore.dispatcher import AppstoreDispatcher\n'), (10, 'django.conf.urls.defaults.url', 'url', (['"""^$"""', '"""appstore"""'], {'name': '"""appstore"""'}), False, 'from django.conf.urls.defaults import url, include, patterns\n'), (11, 'django.conf.urls.defaults.url', 'url', (['"""^api/"""', '"""appstore_api"""'], {'name': '"""appstore_api"""'}), False, 'from django.conf.urls.defaults import url, include, patterns\n'), (14, 'django.conf.urls.defaults.url', 'url', (['"""^(?P<domain>[\\\\w\\\\.-]+)/info/$"""', '"""project_info"""'], {'name': '"""project_info"""'}), False, 'from django.conf.urls.defaults import url, include, patterns\n'), (16, 'django.conf.urls.defaults.url', 'url', (['"""^deployments/$"""', '"""deployments"""'], {'name': '"""deployments"""'}), False, 'from django.conf.urls.defaults import url, include, patterns\n'), (17, 'django.conf.urls.defaults.url', 'url', (['"""^deployments/api/$"""', '"""deployments_api"""'], {'name': '"""deployments_api"""'}), False, 'from django.conf.urls.defaults import url, include, patterns\n'), (18, 'django.conf.urls.defaults.url', 'url', (['"""^deployments/(?P<domain>[\\\\w\\\\.-]+)/info/$"""', '"""deployment_info"""'], {'name': '"""deployment_info"""'}), False, 'from django.conf.urls.defaults import url, include, patterns\n'), (20, 'django.conf.urls.defaults.url', 'url', (['"""^(?P<domain>[\\\\w\\\\.-]+)/approve/$"""', '"""approve_app"""'], {'name': '"""approve_appstore_app"""'}), False, 'from django.conf.urls.defaults import url, include, patterns\n'), (21, 'django.conf.urls.defaults.url', 'url', (['"""^(?P<domain>[\\\\w\\\\.-]+)/copy/$"""', '"""copy_snapshot"""'], {'name': '"""domain_copy_snapshot"""'}), False, 'from django.conf.urls.defaults import url, include, patterns\n'), (22, 'django.conf.urls.defaults.url', 'url', (['"""^(?P<domain>[\\\\w\\\\.-]+)/importapp/$"""', '"""import_app"""'], {'name': '"""import_app_from_snapshot"""'}), False, 'from django.conf.urls.defaults import url, include, patterns\n'), (23, 'django.conf.urls.defaults.url', 'url', (['"""^(?P<domain>[\\\\w\\\\.-]+)/image/$"""', '"""project_image"""'], {'name': '"""appstore_project_image"""'}), False, 'from django.conf.urls.defaults import url, include, patterns\n'), (24, 'django.conf.urls.defaults.url', 'url', (['"""^(?P<domain>[\\\\w\\\\.-]+)/multimedia/$"""', '"""media_files"""'], {'name': '"""media_files"""'}), False, 'from django.conf.urls.defaults import url, include, patterns\n'), (12, 'django.conf.urls.defaults.include', 'include', (['store_urls'], {}), False, 'from django.conf.urls.defaults import url, include, patterns\n')]