from django.conf.urls import include, url
from datachimp.views.api import (project,
                                  ml_model,
                                  comment,
                                  invitation,
                                  decode_key,
                                  experiment_custom_object,
                                  experiment_mat_plot,
                                  project_dashboard,
                                  experiment_pull_params,
                                  experiment_image,
                                  experiment_label,
                                  data_version)

urlpatterns = [
    url(r'project/$', project.ProjectAPI.as_view(), name='project'),
    url(r'project/(?P<project_id>\d+)$', project.ProjectAPI.as_view(),
        name='project'),
    url(r'project/(?P<project_id>\d+)$', project.ProjectAPI.as_view(),
        name='project'),
    url(r'project/(?P<project_id>\d+)/dashboard/experiment-metric/$',
        project_dashboard.experiment_metric_chart,
        name='project_dashboard_metric_chart'),
    url(r'project/(?P<project_id>\d+)/dashboard/experiment-metric-filter/$',
        project_dashboard.experiment_metric_filter,
        name='project_dashboard_metric_filter'),
    url(r'project/(?P<project_id>\d+)/dashboard/experiment-duration/$',
        project_dashboard.experiment_duration_chart,
        name='project_dashboard_duration_chart'),
    url(r'project/(?P<project_id>\d+)/dashboard/experiment-duration-filter/$',
        project_dashboard.experiment_duration_filter,
        name='project_dashboard_duration_filter'),
    url(r'project/(?P<project_id>\d+)/dashboard/experiment-parameter-metric/$',
        project_dashboard.experiment_parameter_metric_chart,
        name='project_dashboard_parameter_metric_chart'),
    url(r'project/(?P<project_id>\d+)/dashboard/experiment-parameter-metric-filter/$',
        project_dashboard.experiment_parameter_metric_filter,
        name='project_dashboard_parameter_metric_filter'),
    url(r'ml-model/(?P<project_id>\d+)/$',ml_model.MLModelAPI.as_view(),
        name='ml_model'),
    url(r'ml-model/get-param/(?P<project_id>\d+)/$', ml_model.get_param_fields),
    url(r'ml-model/get-param-select-data/(?P<project_id>\d+)/$', ml_model.send_selected_param_data),
    url(r'create-experiment/(?P<project_id>\d+)/$', ml_model.CreateExperimentAPI.as_view(),
        name='create_experiment'),

    url(r'create-data-version/(?P<project_id>\d+)/$', data_version.CreateDataVersionAPI.as_view({'post': 'create'}),
        name='create_data_version'),
    url(r'retrieve-data-version/(?P<project_id>\d+)/$',
        data_version.RetrieveDataVersionAPI.as_view({'get': 'retrieve'}),
        name='retrieve_data_version'),
    url(r'list-data-version/(?P<project_id>\d+)/$',
        data_version.ListDataVersionAPI.as_view({'get': 'list'}),
        name='retrieve_data_version'),

    url(r'comment/(?P<model_id>\d+)$',  comment.CommentAPI.as_view(), name='comment_api'),
    url(r'decode-key/$', decode_key.decode_key,
        name='decode-key'),
    url(r'experiment-custom-object/create/(?P<project_id>\d+)/$',
        experiment_custom_object.ExperimentCustomObjectAPI.as_view(),
        name='experiment_custom_object_create'),
    url(r'experiment-custom-object/retrieve/(?P<project_id>\d+)/$',
        experiment_custom_object.ExperimentCustomObjectAPI.as_view(),
        name='experiment_custom_object_retrieve'),
    url(r'experiment-custom-object/details/(?P<model_id>\d+)/$',
        experiment_custom_object.ExperimentCustomObjectDetailAPI.as_view(),
        name='experiment_custom_object_details'),
    url(r'experiment-mat-plot/create/(?P<project_id>\d+)/$',
        experiment_mat_plot.ExperimentMatPlotAPI.as_view(),
        name='experiment_mat_plot_create'),
    url(r'experiment-mat-plot/details/(?P<model_id>\d+)/$',
        experiment_mat_plot.ExperimentMatPlotAPI.as_view(),
        name='experiment_mat_plot_details'),
    url(r'experiment-pull-param/$',
        experiment_pull_params.ExperimentPullParamAPI.as_view(),
        name='experiment_pull_params'),
    url(r'experiment-images/add-image/(?P<project_id>\d+)/$',
        experiment_image.ExperimentImageCreateAPI.as_view(),
        name='experiment_image_add_image'),
    url(r'experiment-images/data/(?P<model_id>\d+)/$',
        experiment_image.ExperimentImageListAPI.as_view(),
        name='experiment_image_data'),
    url(r'experiment-images/filter/(?P<model_id>\d+)/$',
        experiment_image.ExperimentImageFilterAPI.as_view(),
        name='experiment_image_filter'),
    url(r'experiment-label/(?P<model_id>\d+)/$',
        experiment_label.ExperimentLabelAPI.as_view(),
         name='experiment_label_create'),
    url(r'invite/(?P<project_id>\d+)/$', invitation.SendInviteAPI.as_view(),
         name='invite'),
]
