# -*- coding: utf-8 -*-

from django.contrib import admin
from django_admin import ReadOnlyModelAdmin

from group.models import (GroupInfo, GroupPhotoInfo, GroupPhotoOrderInfo, GroupUserInfo, PhotoCommentInfo,
                          PhotoThumbUpInfo)


class GroupInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin):
    list_display = ('group_id', 'admin_id', 'group_name', 'group_desc', 'group_from', 'session_id', 'group_lock', 'status', 'created_at', 'updated_at')
    list_filter = ('group_from', 'group_lock', 'status')


class GroupUserInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin):
    list_display = ('group_id', 'user_id', 'current_id', 'nickname', 'admin', 'subadmin', 'admin_status', 'user_status', 'passed_at', 'refused_at', 'status', 'created_at', 'updated_at')
    list_filter = ('admin', 'subadmin', 'user_status', 'admin_status', 'status')


class GroupPhotoInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin):
    list_display = ('photo_id', 'group_id', 'user_id', 'nickname', 'photo_path', 'has_watermark', 'photo_from', 'lensman_type', 'photo_thumbnail_path', 'photo_thumbnail2_path', 'status', 'created_at', 'updated_at')
    list_filter = ('has_watermark', 'photo_from', 'lensman_type', 'status')


class GroupPhotoOrderInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin):
    list_display = ('group_id', 'user_id', 'photo_id', 'm_photo_path', 'l_photo_path', 'r_photo_path', 'status', 'created_at', 'updated_at')


class PhotoCommentInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin):
    list_display = ('photo_id', 'user_id', 'nickname', 'to_uid', 'comment', 'status', 'created_at', 'updated_at')
    list_filter = ('status', )


class PhotoThumbUpInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin):
    list_display = ('photo_id', 'user_id', 'nickname', 'thumbup', 'status', 'created_at', 'updated_at')
    list_filter = ('thumbup', 'status')


admin.site.register(GroupInfo, GroupInfoAdmin)
admin.site.register(GroupUserInfo, GroupUserInfoAdmin)
admin.site.register(GroupPhotoInfo, GroupPhotoInfoAdmin)
admin.site.register(GroupPhotoOrderInfo, GroupPhotoOrderInfoAdmin)
admin.site.register(PhotoCommentInfo, PhotoCommentInfoAdmin)
admin.site.register(PhotoThumbUpInfo, PhotoThumbUpInfoAdmin)
