import * as Data from 'effect/Data';
import * as Schema from 'effect/Schema';
import { InboxSenderAuthPolicy } from '../inboxes/types.js';
import { SignatureWithRecovery } from '../types.js';
export const EventAuthor = /*#__PURE__*/Schema.Struct({
  accountAddress: Schema.String,
  signature: SignatureWithRecovery
});
export const SpaceMember = /*#__PURE__*/Schema.Struct({
  accountAddress: Schema.String,
  role: /*#__PURE__*/Schema.Union(/*#__PURE__*/Schema.Literal('admin'), /*#__PURE__*/Schema.Literal('member'))
});
export const SpaceInvitation = /*#__PURE__*/Schema.Struct({
  inviteeAccountAddress: Schema.String
});
export const SpaceInbox = /*#__PURE__*/Schema.Struct({
  inboxId: Schema.String,
  encryptionPublicKey: Schema.String,
  isPublic: Schema.Boolean,
  authPolicy: InboxSenderAuthPolicy,
  secretKey: Schema.String
});
export const SpaceState = /*#__PURE__*/Schema.Struct({
  id: Schema.String,
  invitations: /*#__PURE__*/Schema.Record({
    key: Schema.String,
    value: SpaceInvitation
  }),
  members: /*#__PURE__*/Schema.Record({
    key: Schema.String,
    value: SpaceMember
  }),
  removedMembers: /*#__PURE__*/Schema.Record({
    key: Schema.String,
    value: SpaceMember
  }),
  inboxes: /*#__PURE__*/Schema.Record({
    key: Schema.String,
    value: SpaceInbox
  }),
  lastEventHash: Schema.String
});
export const CreateSpaceEvent = /*#__PURE__*/Schema.Struct({
  transaction: /*#__PURE__*/Schema.Struct({
    type: /*#__PURE__*/Schema.Literal('create-space'),
    id: Schema.String,
    creatorAccountAddress: Schema.String
  }),
  author: EventAuthor
});
export const DeleteSpaceEvent = /*#__PURE__*/Schema.Struct({
  transaction: /*#__PURE__*/Schema.Struct({
    type: /*#__PURE__*/Schema.Literal('delete-space'),
    id: Schema.String,
    previousEventHash: Schema.String
  }),
  author: EventAuthor
});
export const CreateInvitationEvent = /*#__PURE__*/Schema.Struct({
  transaction: /*#__PURE__*/Schema.Struct({
    type: /*#__PURE__*/Schema.Literal('create-invitation'),
    id: Schema.String,
    inviteeAccountAddress: Schema.String,
    previousEventHash: Schema.String
  }),
  author: EventAuthor
});
export const CreateSpaceInboxEvent = /*#__PURE__*/Schema.Struct({
  transaction: /*#__PURE__*/Schema.Struct({
    type: /*#__PURE__*/Schema.Literal('create-space-inbox'),
    id: Schema.String,
    spaceId: Schema.String,
    inboxId: Schema.String,
    encryptionPublicKey: Schema.String,
    secretKey: Schema.String,
    isPublic: Schema.Boolean,
    authPolicy: InboxSenderAuthPolicy,
    previousEventHash: Schema.String
  }),
  author: EventAuthor
});
export const AcceptInvitationEvent = /*#__PURE__*/Schema.Struct({
  transaction: /*#__PURE__*/Schema.Struct({
    id: Schema.String,
    type: /*#__PURE__*/Schema.Literal('accept-invitation'),
    previousEventHash: Schema.String
  }),
  author: EventAuthor
});
export const SpaceEvent = /*#__PURE__*/Schema.Union(CreateSpaceEvent, DeleteSpaceEvent, CreateInvitationEvent, AcceptInvitationEvent, CreateSpaceInboxEvent);
export const Author = /*#__PURE__*/Schema.Struct({
  accountAddress: Schema.String,
  signaturePublicKey: Schema.String,
  signaturePrivateKey: Schema.String,
  encryptionPublicKey: Schema.String
});
export class VerifySignatureError extends /*#__PURE__*/Data.TaggedError('VerifySignatureError') {}
export class InvalidEventError extends /*#__PURE__*/Data.TaggedError('InvalidEventError') {}
//# sourceMappingURL=types.js.map