from api.models import BeautyPhoto


class BeautyService(object):

    @classmethod
    def get_beauty_info(cls, image_url=None):
        data = {
            'id': '',
            'url': '',
            'gender': '',
            'name': '',
            'is_online': '',
        }
        if not image_url:
            return data

        beauty_photo = {}
        if image_url:
            beauty_photo = BeautyPhoto.objects.filter(url=image_url).first()
        if not beauty_photo:
            return data

        return {
            'id': beauty_photo.id,
            'url': beauty_photo.url,
            'gender': beauty_photo.gender,
            'name': beauty_photo.role_name,
            'is_online': beauty_photo.is_online,
        }
