package com.ecep.contract.ds.customer.repository;

import java.util.Optional;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.ecep.contract.ds.MyRepository;
import com.ecep.contract.model.Company;
import com.ecep.contract.model.CompanyCustomer;

@Repository
public interface CompanyCustomerRepository extends MyRepository<CompanyCustomer, Integer> {

    Optional<CompanyCustomer> findByCompany(Company company);

    @Modifying
    @Transactional
    int deleteAllByCompany(Company company);
}
