import { CollectionConfig } from "payload/types"

const Media: CollectionConfig = {
    slug: "media",
    admin: {
        useAsTitle: "title"
    },
    access: {
        read: () => true
    },
    upload: {
        staticDir: "media",
        staticURL: "/media",
        imageSizes: [
            {
                name: "small",
                width: 256,
                height: undefined,
                fit: "cover"
            },
            {
                name: "medium",
                width: 512,
                height: undefined,
                fit: "cover"
            },
            {
                name: "large",
                width: 1024,
                height: undefined,
                fit: "cover"
            }
        ],
        mimeTypes: ["image/*", "video/*", "audio/*"]
    },
    fields: [
        {
            name: "title",
            type: "text",
            required: true
        },
    ]
}

export default Media
