import { operation, buildingBase, buildingCommonMethods, buildingView, requestBodySchema, response200, response500, security, statusSchema, tags, } from '../../chunks.ts'; const base = buildingBase('DistributionCenter'); const reserveSchema = { type: 'object', properties: { can: { type: 'integer', enum: [1, 0] }, seconds_remaining: { type: 'integer', description: 'Time until reserved resources will automatically be released.', }, max_reserve_duration: { type: 'integer', description: 'Max length resources can be kept in reserve.', }, max_reserve_size: { type: 'integer', description: 'Max amount of resources that can be reserved.', }, resources: { type: 'array', description: 'Resources currently in reserve.', items: { type: 'object', properties: { type: { type: 'string' }, quantity: { type: 'integer' } }, required: ['type', 'quantity'], }, }, }, required: ['can', 'seconds_remaining', 'max_reserve_duration', 'max_reserve_size', 'resources'], }; const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' } }, }); export const distributionCenter = { ...buildingCommonMethods(base), ...buildingView(base, { reserve: reserveSchema }, ['reserve']), [`${base}/reserve`]: { post: { ...tags(base), ...security(), ...operation( 'Reserve resources.', 'Reserves resources so they are held until the timer expires or manually released. Returns the building view. Throws 1009, 1010, and 1011.' ), ...requestBodySchema({ type: 'object', required: ['building_id', 'resources'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, resources: { type: 'array', description: "Resources to reserve so they don't get automatically spent.", items: { type: 'object', properties: { type: { type: 'string' }, quantity: { type: 'integer', description: 'How many to process. Defaults to 1.' }, }, required: ['type', 'quantity'], }, }, }, }), responses: { ...response200( 'Reserves resources so they are held until the timer expires or manually released. Returns the building view. Throws 1009, 1010, and 1011.', { type: 'object', required: ['building', 'status', 'reserve'], properties: { building: { $ref: '#/components/schemas/building' }, status: statusSchema(), reserve: reserveSchema, }, } ), ...response500(), }, }, }, [`${base}/release_reserve`]: { post: { ...tags(base), ...security(), ...operation('Release reserve.', 'Returns the resources held in reserve back to the planet.'), ...buildingIdRequestBody, responses: { ...response200('Returns the resources held in reserve back to the planet.', { type: 'object', required: ['status'], properties: { status: statusSchema() }, }), ...response500(), }, }, }, [`${base}/get_stored_resources`]: { post: { ...tags(base), ...security(), ...operation( 'Get stored resources.', 'Returns a list of the resources you have stored, to make it easier to identify what you want to store.' ), ...buildingIdRequestBody, responses: { ...response200( 'Returns a list of the resources you have stored, to make it easier to identify what you want to store.', { type: 'object', required: ['status', 'cargo_space_used_each', 'resources'], properties: { status: statusSchema(), cargo_space_used_each: { type: 'integer' }, resources: { type: 'object', description: 'Keyed by resource type.', additionalProperties: { type: 'integer' }, }, }, } ), ...response500(), }, }, }, };