Knowing the protection level of an attachment

Hello. How can i know if an attachment is under some protection level (programatically in PHP)

An API guide will be quite useful for the plugin!

Thanks in advance