import { mtMap } from '@metorial/util-resource-mapper';

export type DashboardInstanceIdentitiesDelegationConfigsGetOutput = {
  object: 'identity.delegation_config';
  id: string;
  status: 'active' | 'archived' | 'deleted';
  isDefault: boolean;
  name: string | null;
  description: string | null;
  metadata: Record<string, any> | null;
  subDelegationBehavior: 'allow' | 'deny' | 'require_consent';
  subDelegationDepth: number;
  createdAt: Date;
  updatedAt: Date;
};

export let mapDashboardInstanceIdentitiesDelegationConfigsGetOutput =
  mtMap.object<DashboardInstanceIdentitiesDelegationConfigsGetOutput>({
    object: mtMap.objectField('object', mtMap.passthrough()),
    id: mtMap.objectField('id', mtMap.passthrough()),
    status: mtMap.objectField('status', mtMap.passthrough()),
    isDefault: mtMap.objectField('is_default', mtMap.passthrough()),
    name: mtMap.objectField('name', mtMap.passthrough()),
    description: mtMap.objectField('description', mtMap.passthrough()),
    metadata: mtMap.objectField('metadata', mtMap.passthrough()),
    subDelegationBehavior: mtMap.objectField(
      'sub_delegation_behavior',
      mtMap.passthrough()
    ),
    subDelegationDepth: mtMap.objectField(
      'sub_delegation_depth',
      mtMap.passthrough()
    ),
    createdAt: mtMap.objectField('created_at', mtMap.date()),
    updatedAt: mtMap.objectField('updated_at', mtMap.date())
  });

