import CRUDBase from '../CRUDBase.js'

class VaultResource extends CRUDBase {
    constructor() {
        super()

        this.endpoint = '/api/v1/vault/vaults'
        this.required_fields = ['name']
        this.permission_base = 'v1:vault:vaults'

        this.item = 'Vault'
        this.plural = 'Vaults'

        this.listing_definition = {
            display: `Vaults are encrypted key-value stores that can be managed with IAM and accessed via REST APIs.`,
            columns: [
                {
                    name: 'Name',
                    field: 'name',
                },
            ],
            actions: [
                {
                    type: 'resource',
                    position: 'main',
                    action: 'insert',
                    text: 'Create New',
                    color: 'success',
                },
                {
                    type: 'resource',
                    position: 'row',
                    action: 'update',
                    icon: 'fa fa-edit',
                    color: 'primary',
                },
                {
                    type: 'resource',
                    position: 'row',
                    action: 'delete',
                    icon: 'fa fa-times',
                    color: 'danger',
                    confirm: true,
                },
            ],
        }

        this.form_definition = {
            fields: [
                {
                    name: 'Name',
                    field: 'name',
                    required: true,
                    type: 'text',
                },
            ],
        }
    }
}

const vault_vault = new VaultResource()
export { vault_vault }
