Countries can’t possibly produce everything within their borders they need to keep their citizens happy. The only solution is to produce what you can based on the resources you have and buy all the rest from abroad. Producing everything would mean spreading a country’s resources and labour very thinly and inefficiently (imagine Ireland had to build its own cars, electronics etc).
Like any business, a country focuses on what it can best produce with trade making the whole system operate smoothly. This means Ireland can buy cars from Japan and electronics from the US or China while it focuses on producing agricultural, chemicals, medicines, financial services and all the other things Ireland has an advantage in (whether absolute, or relative vis-à-vis the trading partner in question)
Heres the PDF PIIGSty Econ 101 #29 International Trade
A government, through its resources, has substantial economic power. As such, a government can regulate trade (limiting it, making the country more ‘protectionist’ or promoting it, making the country more ‘open’)