# coding: utf-8

from django.conf.urls import patterns, url
from django.views.generic import TemplateView
from django.contrib.auth.decorators import login_required

from .views import (
    SelectGender,
    SelectCity,
    SelectPositionCategory,
    SelectCategoryTag,
    SelectDegree,
    SelectWorkyears,
    PersonInfo,
    SocialPageView,
    ShowResume,
    WorkExperienceView,
    EducationView,
    ProjectView,
    ProfessionalSkillView,
    DeleteAdditionInfo,
    EditResumeTag,
    EditCategoryTag,
    DeleteResumeTag,
    AddResumeTag,
    EditSalaryLowest,
    SelectPreferField,
)
from .forms import (
    PersonInfoForm,
    ContactInfoForm,
    SelfIntroForm,
)
from .models import (
    WorkExperience,
    Education,
    Project,
    ProfessionalSkill,
)

urlpatterns = patterns(
    '',
    url(
        '^$',
        login_required(TemplateView.as_view(
            template_name='resume_index.html',
        )),
        name='resume-index',
    ),
    url(
        '^select_gender/$',
        SelectGender.as_view(),
        name='resume-select-gender',
    ),
    url(
        '^select_city/$',
        SelectCity.as_view(),
        name='resume-select-city',
    ),
    url(
        '^select_position_category/$',
        SelectPositionCategory.as_view(),
        name='resume-select-position-category',
    ),
    url(
        '^select_category_tag/$',
        SelectCategoryTag.as_view(),
        name='resume-select-category-tag',
    ),
    url(
        '^select_degree/$',
        SelectDegree.as_view(),
        name='resume-select-degree',
    ),
    url(
        '^select_workyears/$',
        SelectWorkyears.as_view(),
        name='resume-select-workyears',
    ),
    url(
        '^show_resume/$',
        ShowResume.as_view(),
        name='resume-show-resume',
    ),
    url(
        '^save_person_info/$',
        PersonInfo.as_view(
            form=PersonInfoForm,
        ),
        name='resume-save-person-info'
    ),
    url(
        '^save_contact_info/$',
        PersonInfo.as_view(
            form=ContactInfoForm,
        ),
        name='resume-save-contact-info'
    ),
    url(
        '^save_self_eva_info/$',
        PersonInfo.as_view(
            form=SelfIntroForm,
        ),
        name='resume-save-self-eva-info'
    ),
    url(
        '^save_social_page/(?P<page_type>(github|zhihu|dribbble|weibo|zhihu|douban|linkedin))/$',
        SocialPageView.as_view(),
        name='resume-save-social-page'
    ),
    url(
        '^save_work_experience/$',
        WorkExperienceView.as_view(),
        name='resume-save-work-experience'
    ),
    url(
        '^delete_work_experience/(?P<obj_id>\d+)/$',
        DeleteAdditionInfo.as_view(
            model=WorkExperience,
        ),
        name='resume-delete-work-experience'
    ),
    url(
        '^save_education/$',
        EducationView.as_view(),
        name='resume-save-education'
    ),
    url(
        '^delete_education/(?P<obj_id>\d+)/$',
        DeleteAdditionInfo.as_view(
            model=Education,
        ),
        name='resume-delete-education'
    ),
    url(
        '^save_project/$',
        ProjectView.as_view(),
        name='resume-save-project'
    ),
    url(
        '^delete_project/(?P<obj_id>\d+)/$',
        DeleteAdditionInfo.as_view(
            model=Project,
        ),
        name='resume-delete-project'
    ),
    url(
        '^save_professional_skill/$',
        ProfessionalSkillView.as_view(),
        name='resume-save-professional-skill'
    ),
    url(
        '^delete_professional_skill/(?P<obj_id>\d+)/$',
        DeleteAdditionInfo.as_view(
            model=ProfessionalSkill,
        ),
        name='resume-delete-professional-skill'
    ),
    url(
        '^edit_tag/$',
        login_required(TemplateView.as_view(
            template_name='edit_resume_tag.html',
        )),
        name='resume-edit-tag',
    ),
    url(
        '^edit_resume_tag/$',
        EditResumeTag.as_view(),
        name='resume-edit-resume-tag',
    ),
    url(
        '^edit_category_tag/$',
        EditCategoryTag.as_view(),
        name='resume-edit-category-tag',
    ),
    url(
        '^delete_resume_tag/(?P<tag_id>\d+)/$',
        DeleteResumeTag.as_view(),
        name='resume-delete-resume-tag',
    ),
    url(
        '^add_resume_tag/$',
        AddResumeTag.as_view(),
        name='resume-add-resume-tag',
    ),
    url(
        '^select_salary_lowest/$',
        EditSalaryLowest.as_view(),
        name='resume-select-salary-lowest',
    ),
    url(
        '^select_prefer_field/$',
        SelectPreferField.as_view(),
        name='resume-select-prefer-field',
    ),
)
