// Code generated by tools/cmd/genreadfile/main.go. DO NOT EDIT.

package jws

import (
	"fmt"
	"io/fs"
	"os"
)

type sysFS struct{}

func (sysFS) Open(path string) (fs.File, error) {
	return os.Open(path)
}

func ReadFile(path string, options ...ReadFileOption) (*Message, error) {

	var srcFS fs.FS = sysFS{}
	for _, option := range options {
		switch option.Ident() {
		case identFS{}:
			if err := option.Value(&srcFS); err != nil {
				return nil, fmt.Errorf("failed to set fs.FS: %w", err)
			}
		}
	}

	f, err := srcFS.Open(path)
	if err != nil {
		return nil, err
	}

	defer f.Close()
	return ParseReader(f)
}
