import * as plugins from '../plugins.ts';
import * as data from '../data/index.ts';

export interface IReq_ListNamedPolicies extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_ListNamedPolicies
> {
  method: 'listNamedPolicies';
  request: {
    identity: data.IIdentity;
  };
  response: {
    policies: data.INamedPolicy[];
  };
}

export interface IReq_CreateNamedPolicy extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_CreateNamedPolicy
> {
  method: 'createNamedPolicy';
  request: {
    identity: data.IIdentity;
    name: string;
    description: string;
    statements: data.IObjstStatement[];
  };
  response: {
    policy: data.INamedPolicy;
  };
}

export interface IReq_UpdateNamedPolicy extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_UpdateNamedPolicy
> {
  method: 'updateNamedPolicy';
  request: {
    identity: data.IIdentity;
    policyId: string;
    name: string;
    description: string;
    statements: data.IObjstStatement[];
  };
  response: {
    policy: data.INamedPolicy;
  };
}

export interface IReq_DeleteNamedPolicy extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_DeleteNamedPolicy
> {
  method: 'deleteNamedPolicy';
  request: {
    identity: data.IIdentity;
    policyId: string;
  };
  response: {
    ok: boolean;
  };
}

export interface IReq_GetBucketNamedPolicies extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_GetBucketNamedPolicies
> {
  method: 'getBucketNamedPolicies';
  request: {
    identity: data.IIdentity;
    bucketName: string;
  };
  response: {
    attachedPolicies: data.INamedPolicy[];
    availablePolicies: data.INamedPolicy[];
  };
}

export interface IReq_AttachPolicyToBucket extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_AttachPolicyToBucket
> {
  method: 'attachPolicyToBucket';
  request: {
    identity: data.IIdentity;
    policyId: string;
    bucketName: string;
  };
  response: {
    ok: boolean;
  };
}

export interface IReq_DetachPolicyFromBucket extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_DetachPolicyFromBucket
> {
  method: 'detachPolicyFromBucket';
  request: {
    identity: data.IIdentity;
    policyId: string;
    bucketName: string;
  };
  response: {
    ok: boolean;
  };
}

export interface IReq_GetPolicyBuckets extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_GetPolicyBuckets
> {
  method: 'getPolicyBuckets';
  request: {
    identity: data.IIdentity;
    policyId: string;
  };
  response: {
    attachedBuckets: string[];
    availableBuckets: string[];
  };
}

export interface IReq_SetPolicyBuckets extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_SetPolicyBuckets
> {
  method: 'setPolicyBuckets';
  request: {
    identity: data.IIdentity;
    policyId: string;
    bucketNames: string[];
  };
  response: {
    ok: boolean;
  };
}
