Machine coding: build a communication service handling multiple request types (Email, SMS, Soundbox) with per-type mandatory fields; providers support one or more channels, multiple providers per channel, providers have multiple accounts (e.g. for critical OTP traffic); randomly select one active eligible provider per request. Asked in the Machine coding stage.
Output
- Return one row per valid request with
request_id, request_type, account_id, and provider_name.
- Exclude requests missing their type-specific mandatory field or lacking an eligible account.
- Select only active providers and accounts, require critical OTP support when applicable, and order by
request_id.
Output details
- Treat
email_address, phone_number, and soundbox_device_id as present only when non-NULL and nonblank after trimming whitespace.
- Require critical-OTP support unless
is_critical_otp is exactly FALSE; treat NULL as requiring support.
- Choose randomly among eligible provider-account rows, so multiple accounts from one provider are separate choices.
- Order results by
request_id ascending.