import { ViewMode } from '../event/index.js';

export enum ProfileType {
  RESERVED = 'RESERVED',
  CUSTOM = 'CUSTOM'
}

export class Profile {
  id: string;
  key: string;
  displayName: string;
  description: string;
  type: ProfileType;
  allowedInEditor?: boolean;
  allowedInPreview?: boolean;
  allowedInDeployed?: boolean;

  constructor({
    id,
    key,
    displayName,
    description,
    type,
    allowedInEditor,
    allowedInPreview,
    allowedInDeployed
  }: {
    id: string;
    key: string;
    displayName: string;
    description: string;
    type: ProfileType;
    allowedInEditor?: boolean;
    allowedInPreview?: boolean;
    allowedInDeployed?: boolean;
  }) {
    this.id = id;
    this.key = key;
    this.displayName = displayName;
    this.description = description;
    this.type = type;
    this.allowedInEditor = allowedInEditor;
    this.allowedInPreview = allowedInPreview;
    this.allowedInDeployed = allowedInDeployed;
  }
}

export type EntityModeProfileSettings = {
  availableProfileIds: string[];
  defaultProfileId: string;
};

export type EntityProfileSettings = {
  profiles: {
    [ViewMode.EDITOR]: EntityModeProfileSettings;
    [ViewMode.PREVIEW]?: EntityModeProfileSettings;
    [ViewMode.DEPLOYED]: EntityModeProfileSettings;
  };
};
