from django.db import models
from django.contrib.auth.models import User


# 好友表
class Friends(models.Model):
    # 用户
    user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='friends_user')
    # 用户好友
    friend = models.ForeignKey(User, on_delete=models.CASCADE, related_name='friends_friend')
    # 状态码，可以拉黑名单用，为0表示并不是好友，但是对方向自己发送过消息。
    status = models.IntegerField(default=1)


# 好友请求表
class FriendRequest(models.Model):
    # 请求方
    requester = models.ForeignKey(User, on_delete=models.CASCADE, related_name='requester')
    # 接收方
    receiver = models.ForeignKey(User, on_delete=models.CASCADE, related_name='receiver')
