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

from kkconst import BaseConst, ConstIntField


class BaseStatusCode(BaseConst):
    class Meta:
        allow_duplicated_value = False  # status_code should be no duplicated value


class StatusCodeField(ConstIntField):
    def __init__(self, status_code, message='', description=''):
        ConstIntField.__init__(status_code, verbose_name=message, description=description)
        self.message = message


class LensmanStatusCode(BaseStatusCode):
    """ 摄影师相关错误码 4000xx """
    LENSMAN_NOT_FOUND = StatusCodeField(400001, u'Lensman Not Found', description=u'摄影师不存在')
    LENSMAN_PASSWORD_ERROR = StatusCodeField(400002, u'Lensman Password Error', description=u'摄影师密码错误')


class UserStatusCode(BaseStatusCode):
    """ 用户相关错误码  4001xx """
    USER_NOT_FOUND = StatusCodeField(400101, u'User Not Found', description=u'用户不存在')
    USER_PASSWORD_ERROR = StatusCodeField(400102, u'User Password Error', description=u'用户密码错误')
    USERNAME_HAS_REGISTERED = StatusCodeField(400103, u'Username Has Registered', description=u'用户名已注册')

    GUEST_NOT_ALLOWED = StatusCodeField(400111, u'Guest Not ALLOWED', description=u'游客登录未开启')


class PhotoStatusCode(BaseStatusCode):
    """ 照片相关错误码 4010xx """
    PARAMS_ERROR = StatusCodeField(401001, u'Params Error', description=u'参数错误')


class GroupStatusCode(BaseStatusCode):
    """ 群组相关错误码 4020xx """
    GROUP_NOT_FOUND = StatusCodeField(402001, u'Group Not Found', description=u'群组不存在')
    GROUP_HAS_LOCKED = StatusCodeField(402002, u'Group Has Locked', description=u'群组已锁定')
    NOT_GROUP_ADMIN = StatusCodeField(402003, u'Not Group Admin', description=u'非群组管理员')
    NO_UPDATE_PERMISSION = StatusCodeField(402004, u'No Update Permission', description=u'没有更新权限')
    NO_LOCK_PERMISSION = StatusCodeField(402005, u'No Lock Permission', description=u'没有锁定权限')
    NO_UNLOCK_PERMISSION = StatusCodeField(402006, u'No Unlock Permission', description=u'没有解锁权限')
    NO_REMOVE_PERMISSION = StatusCodeField(402007, u'No Remove Permission', description=u'没有移除权限')
    NO_QUIT_PERMISSION = StatusCodeField(402008, u'No Quit Permission', description=u'没有退出权限')
    NO_PASS_PERMISSION = StatusCodeField(402009, u'No Pass Permission', description=u'没有通过权限')
    NO_REFUSE_PERMISSION = StatusCodeField(402010, u'No Refuse Permission', description=u'没有拒绝权限')
    DUPLICATE_JOIN_REQUEST = StatusCodeField(402011, u'Duplicate Join Request', description=u'重复加群申请')
    JOIN_REQUEST_NOT_FOUND = StatusCodeField(402012, u'Join Request Not Found', description=u'加群申请不存在')


class GroupUserStatusCode(BaseStatusCode):
    """ 群组用户相关错误码 4021xx """
    GROUP_USER_NOT_FOUND = StatusCodeField(402101, u'Group User Not Found', description=u'群组用户不存在')
    GROUP_USER_HAS_DELETED = StatusCodeField(402102, u'Group User Has Deleted', description=u'群组用户被移除')


class GroupPhotoStatusCode(BaseStatusCode):
    """ 群组照片（飞图）相关错误码 4022xx """
    GROUP_PHOTO_NOT_FOUND = StatusCodeField(402201, u'Group Photo Not Found', description=u'飞图不存在')
    THUMB_UP_NOT_FOUND = StatusCodeField(402202, u'Thumb Up Not Found', description=u'未点赞')
    DUPLICATE_THUMB_UP = StatusCodeField(402203, u'Duplicate Thumb Up', description=u'重复点赞')


class OrderStatusCode(BaseStatusCode):
    """ 订单／支付相关错误码 4040xx """
    WX_UNIFIED_ORDER_FAIL = StatusCodeField(404000, u'WX Unified Order Fail', description=u'微信统一下单失败')
    WX_ORDER_NOT_FOUND = StatusCodeField(404001, u'WX Order Not Found', description=u'订单不存在')
    WX_ORDER_NOT_PAY = StatusCodeField(404002, u'WX Order Not Pay', description=u'订单未支付')
    WX_ORDER_PAYING = StatusCodeField(404003, u'WX Order Paying', description=u'订单支付中')
    WX_ORDER_PAY_FAIL = StatusCodeField(404009, u'WX Order Pay Fail', description=u'微信支付失败')
    SIGN_CHECK_FAIL = StatusCodeField(404010, u'Sign Check Fail', description=u'签名校验失败')
    FEE_CHECK_FAIL = StatusCodeField(404011, u'FEE Check Fail', description=u'金额校验失败')
    NO_DETAIL_PERMISSION = StatusCodeField(404015, u'No Detail Permission', description=u'没有详情权限')


class MessageStatusCode(BaseStatusCode):
    """ 消息相关错误码 4090xx """
    MESSAGE_NOT_FOUND = StatusCodeField(409001, u'Message Not Found', description=u'消息不存在')
