import { W3CVerifiablePresentation } from '@veramo/core';
import { AuthorizationRequestOAuth2, AuthorizationResponseOAuth2 } from './oauth2.js';

interface AuthorizationRequest extends Omit<AuthorizationRequestOAuth2, 'response_type'> {
    response_type: 'id_token' | 'vp_token' | 'code' | 'vp_token id_token';
    nonce: string;
    presentation_definition?: PresentationDefinition;
    presentation_definition_uri?: string;
    authorization_details?: string;
    client_metadata?: string;
    client_metadata_uri?: string;
    id_token_type?: string;
    response_mode?: 'post' | 'fragment' | 'query';
    display?: string;
    prompt?: string;
    max_age?: number;
    ui_locales?: string;
    id_token_hint?: string;
    acr_values?: string;
    claims?: string;
    request?: string;
    request_uri?: string;
    code_challenge?: string;
    code_challenge_method?: string;
}
type AuthorizationResponse = Omit<AuthorizationResponseOAuth2, 'code'> & {
    presentation_submission?: PresentationSubmission;
    vp_token?: W3CVerifiablePresentation | W3CVerifiablePresentation[];
    id_token?: string;
};
type FormatKeysJwt = 'jwt' | 'jwt_vc' | 'jwt_vp';
type FormatKeyLdp = 'ldp' | 'ldp_vc' | 'ldp_vp';
type JWTAlgorithm = 'ES256K' | 'EdDSA' | 'ES384';
type LDPAlgorithm = 'JsonWebSignature2020' | 'Ed25519Signature2018' | 'EcdsaSecp256k1Signature2019' | 'RsaSignature2018';
type Format = Partial<Record<FormatKeysJwt, {
    alg: JWTAlgorithm[];
}> | Record<FormatKeyLdp, {
    proof_type: LDPAlgorithm[];
}>>;
interface Field {
    path: string[];
    id?: string;
    purpose?: string;
    name?: string;
    filter?: any;
}
interface Constraints {
    limit_disclosure?: 'required' | 'preferred';
    fields?: Field[];
}
interface InputDescriptor {
    id: string;
    name?: string;
    purpose?: string;
    format?: Format;
    constraints: Constraints;
}
interface PresentationDefinition {
    id: string;
    format?: Format;
    input_descriptors: InputDescriptor[];
}
interface PresentationSubmission {
    id: string;
    definition_id: string;
    descriptor_map: DescriptorMap[];
}
interface DescriptorMap {
    id: string;
    format: string;
    path: string;
    path_nested?: DescriptorMap;
}

export type { AuthorizationRequest, AuthorizationResponse, PresentationDefinition, PresentationSubmission };
