-- Eliminar registros existentes donde property = '*'
DELETE FROM `salix`.ACL WHERE model = 'entry' AND property = '*';

-- Insertar permisos para los métodos solicitados en el modelo Entry
INSERT INTO `salix`.ACL (model, property, accessType, permission, principalType, principalId)
VALUES
    -- Permisos para administrative
    ('Entry', 'upsert', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
    ('Entry', 'updateAttributes', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
    ('Entry', 'isBooked', 'READ', 'ALLOW', 'ROLE', 'administrative'),
    ('Entry', 'findById', 'READ', 'ALLOW', 'ROLE', 'administrative'),
    ('Entry', 'find', 'READ', 'ALLOW', 'ROLE', 'administrative'),
    ('Entry', 'filter', 'READ', 'ALLOW', 'ROLE', 'administrative'),
    ('Entry', 'count', 'READ', 'ALLOW', 'ROLE', 'administrative'),
    ('Entry', 'getEntry', 'READ', 'ALLOW', 'ROLE', 'administrative'),
    ('Entry', 'getBuys', 'READ', 'ALLOW', 'ROLE', 'administrative'),
    ('Entry', 'findOne', 'READ', 'ALLOW', 'ROLE', 'administrative'),
    ('Entry', 'deleteBuys', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
    ('Entry', 'editLatestBuys', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
    ('Entry', 'importBuys', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
    ('Entry', 'importBuysPreview', 'READ', 'ALLOW', 'ROLE', 'administrative'),
    ('Entry', 'lastItemBuys', 'READ', 'ALLOW', 'ROLE', 'administrative'),
    ('Entry', 'latestBuysFilter', 'READ', 'ALLOW', 'ROLE', 'administrative'),

    -- Permisos para buyer (excluyendo isBooked)
    ('Entry', 'upsert', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
    ('Entry', 'updateAttributes', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
    ('Entry', 'findById', 'READ', 'ALLOW', 'ROLE', 'buyer'),
    ('Entry', 'find', 'READ', 'ALLOW', 'ROLE', 'buyer'),
    ('Entry', 'filter', 'READ', 'ALLOW', 'ROLE', 'buyer'),
    ('Entry', 'count', 'READ', 'ALLOW', 'ROLE', 'buyer'),
    ('Entry', 'getEntry', 'READ', 'ALLOW', 'ROLE', 'buyer'),
    ('Entry', 'getBuys', 'READ', 'ALLOW', 'ROLE', 'buyer'),
    ('Entry', 'findOne', 'READ', 'ALLOW', 'ROLE', 'buyer'),
    ('Entry', 'deleteBuys', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
    ('Entry', 'editLatestBuys', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
    ('Entry', 'importBuys', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
    ('Entry', 'importBuysPreview', 'READ', 'ALLOW', 'ROLE', 'buyer'),
    ('Entry', 'lastItemBuys', 'READ', 'ALLOW', 'ROLE', 'buyer'),
    ('Entry', 'latestBuysFilter', 'READ', 'ALLOW', 'ROLE', 'buyer');
