import { operation, buildingBase, buildingCommonMethods, buildingView, requestBodySchema, response200, response500, security, statusSchema, tags, } from '../../chunks.ts'; const base = buildingBase('MissionCommand'); const missionIdRequestBody = (extraDescription: string) => requestBodySchema({ type: 'object', required: ['building_id', 'mission_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, mission_id: { type: 'integer', description: extraDescription }, }, }); export const missionCommand = { ...buildingCommonMethods(base), ...buildingView(base), [`${base}/get_missions`]: { post: { ...tags(base), ...security(), ...operation( 'Get missions.', "Returns a (non-exhaustive) list of missions eligible to be completed in this zone. Excludes missions already completed or above the empire's university level." ), ...requestBodySchema({ type: 'object', required: ['building_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, }, }), responses: { ...response200( "Returns a (non-exhaustive) list of missions eligible to be completed in this zone. Excludes missions already completed or above the empire's university level.", { type: 'object', required: ['missions', 'status'], properties: { missions: { type: 'array', items: { type: 'object', properties: { id: { type: 'integer' }, max_university_level: { type: 'integer' }, date_posted: { type: 'string' }, name: { type: 'string' }, description: { type: 'string' }, objectives: { type: 'array', items: { type: 'string' } }, rewards: { type: 'array', items: { type: 'string' } }, }, required: [ 'id', 'max_university_level', 'date_posted', 'name', 'description', 'objectives', 'rewards', ], }, }, status: statusSchema(), }, } ), ...response500(), }, }, }, [`${base}/complete_mission`]: { post: { ...tags(base), ...security(), ...operation( 'Complete mission.', 'Completes a mission. Rejected if the objectives are not all met; otherwise the rewards are distributed.' ), ...missionIdRequestBody('The unique id of the mission to complete.'), responses: { ...response200( 'Completes a mission. Rejected if the objectives are not all met; otherwise the rewards are distributed.', { type: 'object', required: ['status'], properties: { status: statusSchema() } } ), ...response500(), }, }, }, [`${base}/skip_mission`]: { post: { ...tags(base), ...security(), ...operation('Skip mission.', 'Skips a mission, hiding it from this list for 30 days.'), ...missionIdRequestBody( "The unique id of the mission to skip. Won't appear again for this empire for 30 days." ), responses: { ...response200('Skips a mission, hiding it from this list for 30 days.', { type: 'object', required: ['status'], properties: { status: statusSchema() }, }), ...response500(), }, }, }, };