export type AttachmentPermissionAction = "create" | "read" | "delete"; const PERMISSIONS_BY_ENTITY_ACTION: Record> = { contract_fee_contract: { create: "fees_contracts:create", read: "fees_contracts:read", delete: "fees_contracts_attachments:delete", }, contract_fee_voucher: { create: "fees_contracts:create", read: "fees_contracts:read", delete: "fees_contracts_attachments:delete", }, contract_fee_invoice: { create: "fees_contracts:create", read: "fees_contracts:read", delete: "fees_contracts_attachments:delete", }, startup_feasibility: { create: "startup_initiation:create", read: "startup_initiation:read", delete: "startup_initiation_attachments:delete", }, startup_ethics: { create: "startup_ethics:create", read: "startup_ethics:read", delete: "startup_ethics_attachments:delete", }, startup_kickoff: { create: "startup_auth:create", read: "startup_auth:read", delete: "startup_auth_attachments:delete", }, startup_kickoff_minutes: { create: "startup_auth:create", read: "startup_auth:read", delete: "startup_auth_attachments:delete", }, startup_kickoff_signin: { create: "startup_auth:create", read: "startup_auth:read", delete: "startup_auth_attachments:delete", }, startup_kickoff_ppt: { create: "startup_auth:create", read: "startup_auth:read", delete: "startup_auth_attachments:delete", }, training_authorization: { create: "startup_auth:create", read: "startup_auth:read", delete: "startup_auth_attachments:delete", }, drug_shipment: { create: "drug_shipments:create", read: "drug_shipments:read", delete: "drug_shipments_attachments:delete", }, material_equipment: { create: "material_equipments:update", read: "material_equipments:read", delete: "material_equipments_attachments:delete", }, precaution: { create: "precautions:create", read: "precautions:read", delete: "precautions_attachments:delete", }, faq_replies: { create: "faq_reply:create", read: "faq:read", delete: "faq_attachments:delete", }, }; export const getAttachmentPermissionKey = ( entityType: string, action: AttachmentPermissionAction ): string | null => { return PERMISSIONS_BY_ENTITY_ACTION[entityType]?.[action] || null; };