Complete the code to allow read access only to authenticated users.
allow read: if request.auth [1] null;
The rule checks that the user is authenticated by ensuring request.auth is not null.
Complete the code to allow write access only if the user's UID matches the document ID.
allow write: if request.auth.uid [1] resource.id;
This rule ensures users can only write to documents that match their own UID.
Fix the error in the rule that allows read access only if the user is authenticated and the document is public.
allow read: if request.auth [1] null && resource.data.public == true;
The rule must check that request.auth is not null to confirm authentication.
Fill both blanks to allow update only if the user is authenticated and the new data has a 'status' field equal to 'active'.
allow update: if request.auth [1] null && request.resource.data.status [2] 'active';
The rule checks that the user is authenticated and the new data's status is exactly 'active'.
Fill all three blanks to allow delete only if the user is authenticated, the document owner matches the user, and the document is not locked.
allow delete: if request.auth.uid [1] resource.data.owner && request.auth [2] null && resource.data.locked [3] false;
The rule ensures the user owns the document, is authenticated, and the document is unlocked before allowing deletion.