import request from '@/utils/request'

export default {
    // 获取家庭信息
    info: {
        url: '/api/account/family/info',
        name: '家庭信息',
        get: async function(params) {
            return request.get(this.url, {params: params})
        }
    },
    // 创建家庭
    create: {
        url: '/api/account/family/create',
        name: '创建家庭',
        post: async function(params) {
            return request.post(this.url, params)
        }
    },
    // 加入家庭
    join: {
        url: '/api/account/family/join',
        name: '加入家庭',
        post: async function(params) {
            return request.post(this.url, params)
        }
    },
    // 退出家庭
    leave: {
        url: '/api/account/family/leave',
        name: '退出家庭',
        post: async function(params) {
            return request.post(this.url, params)
        }
    },
    // 获取家庭邀请码
    inviteCode: {
        url: '/api/account/family/invite-code',
        name: '家庭邀请码',
        get: async function(params) {
            return request.get(this.url, {params: params})
        }
    },
    // 重新生成邀请码
    regenerateInviteCode: {
        url: '/api/account/family/regenerate-invite-code',
        name: '重新生成邀请码',
        post: async function(params) {
            return request.post(this.url, params)
        }
    },
    // 移除家庭成员
    removeMember: {
        url: '/api/account/family/remove-member',
        name: '移除家庭成员',
        post: async function(params) {
            return request.post(this.url, params)
        }
    },
    // 获取家庭成员列表
    members: {
        url: '/api/account/family/members',
        name: '家庭成员列表',
        get: async function(params) {
            return request.get(this.url, {params: params})
        }
    },
    // 转让家主
    transferOwner: {
        url: '/api/account/family/transfer-owner',
        name: '转让家主',
        post: async function(params) {
            return request.post(this.url, params)
        }
    }
}
