class ContactsServiceImpl implements ContactsService {

    @Override
    public Response create(Contacts addContacts, HttpHeaders headers) {
        Contacts contacts = new Contacts();
        contacts.setId(UUID.randomUUID());
        contacts.setName(addContacts.getName());
        contacts.setPhoneNumber(addContacts.getPhoneNumber());
        contacts.setDocumentNumber(addContacts.getDocumentNumber());
        contacts.setAccountId(addContacts.getAccountId());
        contacts.setDocumentType(addContacts.getDocumentType());

        ArrayList<Contacts> accountContacts = contactsRepository.findByAccountId(addContacts.getAccountId());

        if (accountContacts.contains(contacts)) {
            ContactsServiceImpl.LOGGER.info("[Contacts-Add&Delete-Service][AddContacts] Fail.Contacts already exists");
            return new Response<>(0, "Contacts already exists", null);
        } else {
            contactsRepository.save(contacts);
            ContactsServiceImpl.LOGGER.info("[Contacts-Add&Delete-Service][AddContacts] Success.");
            return new Response<>(1, "Create contacts success", contacts);
        }
    }

}