import { operation, buildingBase, buildingCommonMethods, buildingView, requestBodySchema, response200, response500, security, statusSchema, tags, } from '../../chunks.ts'; const base = buildingBase('MercenariesGuild'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' } }, }); const tradeEntrySchema = { type: 'object', properties: { date_offered: { type: 'string' }, id: { type: 'integer' }, ask: { type: 'integer', description: 'Amount of essentia being asked for.' }, offer: { type: 'array', items: { type: 'string' } }, body: { type: 'object', description: 'Only present on view_market. Use with get_trade_ships to determine travel time.', properties: { id: { type: 'integer' } }, required: ['id'], }, empire: { type: 'object', description: 'Only present on view_market.', properties: { id: { type: 'integer' }, name: { type: 'string' } }, required: ['id', 'name'], }, }, required: ['date_offered', 'id', 'ask', 'offer'], }; export const mercenariesGuild = { ...buildingCommonMethods(base), ...buildingView(base), [`${base}/add_to_market`]: { post: { ...tags(base), ...security(), ...operation('Add to market.', 'Queues a trade of a spy for others to see.'), ...requestBodySchema({ type: 'object', required: ['building_id', 'spy_id', 'ask'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, spy_id: { type: 'integer', description: 'See get_spies for a list of your spies.' }, ask: { type: 'integer', minimum: 1, maximum: 99, description: 'Amount of essentia being asked for.', }, ship_id: { type: 'integer', description: 'Optional. See get_trade_ships for details.' }, }, }), responses: { ...response200('Queues a trade of a spy for others to see.', { type: 'object', required: ['trade_id', 'status'], properties: { trade_id: { type: 'integer' }, status: statusSchema() }, }), ...response500(), }, }, }, [`${base}/get_spies`]: { post: { ...tags(base), ...security(), ...operation( 'Get spies.', 'Returns a list of spies that may be traded. Used with add_to_market.' ), ...buildingIdRequestBody, responses: { ...response200('Returns a list of spies that may be traded. Used with add_to_market.', { type: 'object', required: ['spies', 'status'], properties: { spies: { type: 'array', items: { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' }, level: { type: 'integer' }, }, required: ['id', 'name', 'level'], }, }, status: statusSchema(), }, }), ...response500(), }, }, }, [`${base}/withdraw_from_market`]: { post: { ...tags(base), ...security(), ...operation( 'Withdraw from market.', 'Removes a trade that you have offered and collects the items up for trade.' ), ...requestBodySchema({ type: 'object', required: ['building_id', 'trade_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, trade_id: { type: 'integer', description: 'The unique id of the trade.' }, }, }), responses: { ...response200( 'Removes a trade that you have offered and collects the items up for trade.', { type: 'object', required: ['status'], properties: { status: statusSchema() } } ), ...response500(), }, }, }, [`${base}/accept_from_market`]: { post: { ...tags(base), ...security(), ...operation( 'Accept from market.', 'Accepts a trade offer from the list of available trades. See view_market.' ), ...requestBodySchema({ type: 'object', required: ['building_id', 'trade_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, trade_id: { type: 'integer', description: 'The unique id of the trade.' }, }, }), responses: { ...response200( 'Accepts a trade offer from the list of available trades. See view_market.', { type: 'object', required: ['status'], properties: { status: statusSchema() } } ), ...response500(), }, }, }, [`${base}/view_market`]: { post: { ...tags(base), ...security(), ...operation('View market.', 'Displays a list of trades available at the present time.'), ...requestBodySchema({ type: 'object', required: ['building_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, page_number: { type: 'integer', description: 'Optional. Defaults to 1. 25 trades per page.', }, }, }), responses: { ...response200('Displays a list of trades available at the present time.', { type: 'object', required: ['trades', 'trade_count', 'page_number', 'status'], properties: { trades: { type: 'array', items: tradeEntrySchema }, trade_count: { type: 'integer' }, page_number: { type: 'integer' }, status: statusSchema(), }, }), ...response500(), }, }, }, [`${base}/view_my_market`]: { post: { ...tags(base), ...security(), ...operation('View my market.', 'Displays a list of trades the current user has posted.'), ...requestBodySchema({ type: 'object', required: ['building_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, page_number: { type: 'integer', description: 'Optional. Defaults to 1. 25 trades per page.', }, }, }), responses: { ...response200('Displays a list of trades the current user has posted.', { type: 'object', required: ['trades', 'trade_count', 'page_number', 'status'], properties: { trades: { type: 'array', items: tradeEntrySchema }, trade_count: { type: 'integer' }, page_number: { type: 'integer' }, status: statusSchema(), }, }), ...response500(), }, }, }, [`${base}/get_trade_ships`]: { post: { ...tags(base), ...security(), ...operation( 'Get trade ships.', 'Returns a list of the ships that could be used to do a trade.' ), ...requestBodySchema({ type: 'object', required: ['building_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, target_body_id: { type: 'integer', description: 'Optional. If included, the estimated travel time to this body is calculated.', }, }, }), responses: { ...response200('Returns a list of the ships that could be used to do a trade.', { type: 'object', required: ['ships', 'status'], properties: { ships: { type: 'array', items: { type: 'object', properties: { id: { type: 'integer' }, type: { type: 'string' }, name: { type: 'string' }, estimated_travel_time: { type: 'integer', description: 'In seconds, one way. Only present when target_body_id is provided.', }, }, required: ['id', 'type', 'name'], }, }, status: statusSchema(), }, }), ...response500(), }, }, }, [`${base}/report_abuse`]: { post: { ...tags(base), ...security(), ...operation( 'Report abuse.', 'Reports a trade that is suspected of abusing the trade system.' ), ...requestBodySchema({ type: 'object', required: ['building_id', 'trade_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, trade_id: { type: 'integer', description: 'The unique id of the trade.' }, }, }), responses: { ...response200('Reports a trade that is suspected of abusing the trade system.', { type: 'object', required: ['status'], properties: { status: statusSchema() }, }), ...response500(), }, }, }, };