Food delivery companies based in Spain have three months to convert their couriers into staff workers under new rules approved on Tuesday by the government, one of the first laws in Europe regarding gig-economy workers’ rights.

The decree, which was agreed on with trade unions and business associations, aims to clarify the legal situation of thousands of riders after Spain’s Supreme Court ruled last year that companies must hire them as employees.

The new rules came into force immediately, with companies being given 90 days to comply.

A debate on how to regulate workers’ rights in the gig economy is unfolding globally. The European Commission has opened a public consultation period on potential EU-wide rules.

Spain has moved ahead of Europe by transposing into law the Supreme Court ruling, which some companies were still reluctant to comply with, claiming their models were different from those that were the subject of the ruling.

The ruling was related to riders of Spanish start-up Glovo.

Global delivery companies such as Deliveroo and Uber Eats are facing lawsuits over labor rights in a number of countries.

Although the legislation makes it harder for companies to have freelance couriers, closing the door on a common practice, several riders’ associations and labor experts have said it does not completely resolve their legal situation, anticipating further potential court battles.

Most delivery companies have already started preparing for the change, looking for new business models that will allow them to be profitable.

Just-Eat, the Spanish branch of Take Away, has already hired some of its workers and covers peak demand with workers from transport companies.

Others, such as Glovo, have opted to hire some riders through temporary employment agencies, according to riders.

A Glovo spokeswoman and an Uber Eats spokesman declined to comment while awaiting the details. Deliveroo did not immediately respond to a request for comment.