enum TenantCredentialKind {
  api_key
  bearer_token
  basic_auth
  soap_partner
  webhook_signing_secret
  json
}

enum TenantCredentialStatus {
  active
  disabled
  deleted
}

type TenantCredential {
  id: ID!
  tenantId: ID!
  displayName: String!
  slug: String!
  kind: TenantCredentialKind!
  status: TenantCredentialStatus!
  eventbridgeConnectionArn: String
  schemaJson: AWSJSON!
  metadataJson: AWSJSON!
  lastUsedAt: AWSDateTime
  lastValidatedAt: AWSDateTime
  createdByUserId: ID
  deletedAt: AWSDateTime
  createdAt: AWSDateTime!
  updatedAt: AWSDateTime!
}

input CreateTenantCredentialInput {
  tenantId: ID!
  displayName: String!
  slug: String
  kind: TenantCredentialKind!
  metadataJson: AWSJSON
  secretJson: AWSJSON!
}

input UpdateTenantCredentialInput {
  displayName: String
  slug: String
  status: TenantCredentialStatus
  metadataJson: AWSJSON
}

input RotateTenantCredentialInput {
  id: ID!
  secretJson: AWSJSON!
}

extend type Query {
  tenantCredentials(
    tenantId: ID!
    status: TenantCredentialStatus
  ): [TenantCredential!]!
}

extend type Mutation {
  createTenantCredential(input: CreateTenantCredentialInput!): TenantCredential!
  updateTenantCredential(
    id: ID!
    input: UpdateTenantCredentialInput!
  ): TenantCredential!
  rotateTenantCredential(input: RotateTenantCredentialInput!): TenantCredential!
  deleteTenantCredential(id: ID!): Boolean!
}
