import { holidayCode } from './harness'; import type { CaseGroup, Scene } from './types'; /** A user's own addons: journey, atlas, collections, vacay, dawarich and the school holiday catalog. */ const HOLIDAY_CATALOG = "the admin's school holiday catalog is global: no room, and the registry has no event for it"; const TOKEN_ONLY = 'manages a public link token: nothing on any screen follows it live, so there is nothing to send'; const onJourney = (s: Scene) => ({ journeyId: s.journey.id }); const WINTER = { name: 'Winter', startDate: '2027-02-01', endDate: '2027-02-12' }; export const user: CaseGroup = { name: 'user', prefix: 'BCP-USER', cases: [], exempt: [ { tool: 'create_journey_share_link', reason: TOKEN_ONLY, needs: ['journey'], args: onJourney }, { tool: 'delete_journey_share_link', reason: TOKEN_ONLY, needs: ['journey'], args: onJourney, first: { tool: 'create_journey_share_link', args: onJourney }, }, { tool: 'create_manual_school_holiday_country', reason: HOLIDAY_CATALOG, actor: 'admin', args: (s) => ({ code: holidayCode(s.n, 0), name: `Holiday land ${s.n}` }), }, { tool: 'create_manual_school_holiday_region', reason: HOLIDAY_CATALOG, actor: 'admin', needs: ['holidayCountry'], args: (s) => ({ country: s.holidayCountry.code, name: `North ${s.n}`, revision: 0, holidays: [WINTER] }), }, { tool: 'update_manual_school_holiday_region', reason: HOLIDAY_CATALOG, actor: 'admin', needs: ['holidayRegion'], args: (s) => ({ regionId: s.holidayRegion.id, name: `South ${s.n}`, revision: s.holidayRegion.revision, holidays: [WINTER], }), }, { tool: 'delete_manual_school_holiday_region', reason: HOLIDAY_CATALOG, actor: 'admin', needs: ['holidayRegion'], args: (s) => ({ regionId: s.holidayRegion.id, revision: s.holidayRegion.revision }), }, { tool: 'delete_manual_school_holiday_country', reason: HOLIDAY_CATALOG, actor: 'admin', needs: ['holidayCountry'], args: (s) => ({ code: s.holidayCountry.code }), }, ], pending: [ 'create_bucket_list_item', 'delete_bucket_list_item', 'mark_country_visited', 'unmark_country_visited', 'mark_region_visited', 'unmark_region_visited', 'update_bucket_list_item', 'create_collection', 'update_collection', 'delete_collection', 'reorder_collections', 'save_place_to_collection', 'save_trip_places_to_collection', 'update_collection_place', 'set_collection_place_status', 'set_collection_place_status_from_trip', 'rate_collection_place', 'delete_collection_place', 'create_collection_label', 'update_collection_label', 'delete_collection_label', 'assign_collection_labels', 'invite_to_collection', 'set_collection_member_role', 'remove_collection_member', 'cancel_collection_invite', 'accept_collection_invite', 'decline_collection_invite', 'leave_collection', 'accept_dawarich_suggestion_as_place', 'accept_dawarich_suggestion_as_journal_entry', 'mark_bucket_list_item_visited_from_dawarich', 'dismiss_dawarich_suggestion', 'confirm_bucket_list_visits', 'clear_bucket_list_visit', 'accept_atlas_countries', 'create_journey', 'update_journey', 'restore_journey_suggestions', 'delete_journey', 'add_journey_trip', 'remove_journey_trip', 'create_journey_entry', 'update_journey_entry', 'delete_journey_entry', 'reorder_journey_entries', 'reorder_journey_entry_photos', 'add_journey_contributor', 'update_journey_contributor_role', 'remove_journey_contributor', 'update_journey_preferences', 'add_journey_provider_photos', 'link_trip_journal', 'set_trip_journal_members', 'unlink_trip_journal', 'take_over_journey_day_stays', 'save_journey_recorded_day', 'delete_journey_recorded_day', 'update_vacay_plan', 'set_vacay_color', 'send_vacay_invite', 'accept_vacay_invite', 'decline_vacay_invite', 'cancel_vacay_invite', 'dissolve_vacay_plan', 'add_vacay_year', 'delete_vacay_year', 'toggle_vacay_entry', 'toggle_company_holiday', 'update_vacay_stats', 'add_holiday_calendar', 'update_holiday_calendar', 'delete_holiday_calendar', 'share_vacay_calendar', 'unshare_vacay_calendar', ], };