-- Supabase Storage Bucket Setup for Restaurant Assets (Logos, Cover Banners, Menu Items)
insert into storage.buckets (id, name, public)
values ('restaurant-assets', 'restaurant-assets', true)
on conflict (id) do update set public = true;

-- Enable Public Read Access Policy for restaurant-assets bucket
create policy "Public Access for Restaurant Assets"
on storage.objects for select
using ( bucket_id = 'restaurant-assets' );

-- Enable Authenticated User Upload Policy for restaurant-assets bucket
create policy "Authenticated User Upload for Restaurant Assets"
on storage.objects for insert
to authenticated
with check ( bucket_id = 'restaurant-assets' );

-- Enable Authenticated User Update Policy for restaurant-assets bucket
create policy "Authenticated User Update for Restaurant Assets"
on storage.objects for update
to authenticated
using ( bucket_id = 'restaurant-assets' );

-- Enable Authenticated User Delete Policy for restaurant-assets bucket
create policy "Authenticated User Delete for Restaurant Assets"
on storage.objects for delete
to authenticated
using ( bucket_id = 'restaurant-assets' );
