sajad torkamani
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Annotation\ApiProperty;
use Symfony\Component\Serializer\Annotation\Groups;

#[ApiResource(
    normalizationContext: ['groups' => ['read']],
    denormalizationContext: ['groups' => ['write']]
)]
class Product
{
    #[ApiProperty(
        description: "The unique identifier of the product.",
        example: "123",
        openapiContext: [
            'type' => 'integer',
            'description' => 'Unique identifier of the product.',
        ]
    )]
    #[Groups(['read'])]
    private $id;

    #[ApiProperty(
        description: "The name of the product.",
        example: "A fancy Product",
        openapiContext: [
            'type' => 'string',
            'description' => 'Name of the product.',
        ]
    )]
    #[Groups(['read', 'write'])]
    private $name;
}