Files
gridpilot.gg/core/racing/application/use-cases/GetSponsorshipPricingUseCase.ts
2025-12-26 11:49:20 +01:00

61 lines
1.7 KiB
TypeScript

/**
* Application Use Case: GetSponsorshipPricingUseCase
*
* Retrieves general sponsorship pricing tiers.
*/
import { Result } from '@core/shared/application/Result';
import type { UseCaseOutputPort } from '@core/shared/application';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
export type GetSponsorshipPricingInput = Record<string, never>;
export type GetSponsorshipPricingResult = {
entityType: 'season';
entityId: string;
pricing: {
id: string;
level: string;
price: number;
currency: string;
}[];
};
export type GetSponsorshipPricingErrorCode = 'REPOSITORY_ERROR';
export class GetSponsorshipPricingUseCase {
constructor(private readonly output: UseCaseOutputPort<GetSponsorshipPricingResult>) {}
async execute(
_input: GetSponsorshipPricingInput,
): Promise<
Result<void, ApplicationErrorCode<GetSponsorshipPricingErrorCode, { message: string }>>
> {
void _input;
try {
const result: GetSponsorshipPricingResult = {
entityType: 'season',
entityId: '',
pricing: [
{ id: 'tier-bronze', level: 'Bronze', price: 100, currency: 'USD' },
{ id: 'tier-silver', level: 'Silver', price: 250, currency: 'USD' },
{ id: 'tier-gold', level: 'Gold', price: 500, currency: 'USD' },
],
};
this.output.present(result);
return Result.ok(undefined);
} catch (error) {
return Result.err({
code: 'REPOSITORY_ERROR',
details: {
message:
error instanceof Error
? error.message
: 'Failed to load sponsorship pricing',
},
});
}
}
}