package com.sikey.wa04.api.user.client.wristwatch;

import com.sikey.wa04.business.application.service.user.ContactsService;
import com.sikey.wa04.business.infrastructure.configuration.ProjectContextConstant;
import com.sikey.wa04.business.infrastructure.dto.request.contact.GetContactRequest;
import com.sikey.wa04.business.infrastructure.dto.response.contact.GetContactResponse;
import com.sikey.wa04.common.BaseController;
import com.sikey.wa04.common.dto.header.GenericManufacturerHeader;
import com.sikey.wa04.common.interceptor.Authenticated;
import com.sikey.wa04.common.interceptor.CurrentRequestUser;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ContactWristwatchController
 *
 * @author luoyangwei
 * @date 2024 年 10 月 18 日 12:02:35
 */
@RestController
@RequestMapping(ProjectContextConstant.USER_CONTEXT_URL + "/user/child/contacts/wristwatch")
public class ContactWristwatchController extends BaseController {

    @Resource
    private ContactsService contactsService;


    /**
     * 手表获取联系人
     *
     * @return ResponseEntity<GetContactResponse>
     * @see com.sikey.wa04.api.user.client.rest.ContactController#get(GetContactRequest)
     */
    @Authenticated
    @GetMapping("/get")
    public GetContactResponse get() throws Exception {
        GenericManufacturerHeader genericManufacturerHeader = genericManufacturerHeader();
        return contactsService.get(new GetContactRequest(CurrentRequestUser.get().getId()),genericManufacturerHeader,true);
    }
}
