package com.ecep.contract.cloud.tyc;

import java.util.List;
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.CloudTyc;
import com.ecep.contract.model.Company;

@Repository
public interface CloudTycRepository extends MyRepository<CloudTyc, Integer> {

    List<CloudTyc> findAllByCompanyId(Integer companyId);

    Optional<CloudTyc> findByCompanyId(Integer companyId);

    @Modifying
    @Transactional
    int deleteAllByCompany(Company company);

}
