<?php

namespace App\Support\Enums;

enum RelationshipType: string
{
    case AssignedTo = 'assigned_to';
    case AssignedToInclude = 'assigned_to_include';
    case AssignedToExclude = 'assigned_to_exclude';
    case UsesAssignmentFilter = 'uses_assignment_filter';
    case ScopedBy = 'scoped_by';
    case Targets = 'targets';
    case DependsOn = 'depends_on';

    public function label(): string
    {
        return match ($this) {
            self::AssignedTo => 'Assigned to',
            self::AssignedToInclude => 'Assigned to (include)',
            self::AssignedToExclude => 'Assigned to (exclude)',
            self::UsesAssignmentFilter => 'Uses assignment filter',
            self::ScopedBy => 'Scoped by',
            self::Targets => 'Targets',
            self::DependsOn => 'Depends on',
        };
    }

    /**
     * @return array<string, string>
     */
    public static function options(): array
    {
        $options = [];

        foreach (self::cases() as $case) {
            $options[$case->value] = $case->label();
        }

        return $options;
    }
}
